Compare commits
No commits in common. "f7c2f4c612a0d878165ec04da5b5e4be5a604619" and "c42db86e28b16de1fa21765c25e100ad93fea45e" have entirely different histories.
f7c2f4c612
...
c42db86e28
@ -25,11 +25,10 @@ public class DiceView : MonoBehaviour, IBase
|
||||
transform.localPosition = new Vector3(0, 20, 0);
|
||||
}
|
||||
|
||||
public void Roll(Action<int> onComplete, bool isBot)
|
||||
public void Roll(Action<int> onComplete)
|
||||
{
|
||||
if (!rolling)
|
||||
{
|
||||
Debug.Log($"isBot: {isBot}");
|
||||
onRollingComplete = onComplete;
|
||||
StartCoroutine(RollRoutine());
|
||||
}
|
||||
@ -97,12 +96,5 @@ public class DiceView : MonoBehaviour, IBase
|
||||
rb.angularVelocity = Vector3.zero;
|
||||
transform.localPosition = new Vector3(0, 20, 0);
|
||||
rolling = false;
|
||||
|
||||
Invoke(nameof(ResetEvent), 0.5f);
|
||||
}
|
||||
|
||||
private void ResetEvent()
|
||||
{
|
||||
onRollingComplete = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,6 +96,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
{
|
||||
tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
|
||||
|
||||
CanRollDiceForUser = true;
|
||||
|
||||
InitPlayerTypesForBotMatch(PlayerType.Player1, 3);
|
||||
}
|
||||
|
||||
@ -107,8 +109,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
|
||||
playerBaseHandler.InitPlayerTypes(allPlayerTypes);
|
||||
InitCurrentGamePlayerInfo();
|
||||
|
||||
SetCanRollDiceForUser(true);
|
||||
}
|
||||
|
||||
public void InitPlayerTypesForBotMatch(PlayerType selectedPlayerType, int botCount)
|
||||
@ -124,8 +124,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
InitCurrentGamePlayerInfo();
|
||||
InitBotRuntimeData();
|
||||
AssignPlayerAndBotStates(selectedPlayerType);
|
||||
|
||||
SetCanRollDiceForUser(!botTypesInGame.Contains(selectedPlayerType));
|
||||
}
|
||||
|
||||
private void InitBotRuntimeData()
|
||||
@ -246,6 +244,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
{
|
||||
Debug.Log($"Switching player");
|
||||
SwitchPlayer();
|
||||
SetCanRollDiceForUser(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,11 +276,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
// What happens when you get a 6
|
||||
private void SelectPawnFromBotBase()
|
||||
{
|
||||
if (canSwitchPlayer || availPlayers.Count() < 1 && !CanRollDiceAgain || !botTypesInGame.Contains(currentPlayerTypeTurn))
|
||||
{
|
||||
Debug.Log($"returning from SelectPawnFromBotBase");
|
||||
return; // Have a better check here
|
||||
}
|
||||
if (canSwitchPlayer || availPlayers.Count() < 1 && !CanRollDiceAgain || !botTypesInGame.Contains(currentPlayerTypeTurn)) return; // Have a better check here
|
||||
|
||||
Debug.Log($"CallTest: SelectPawnFromBotBase: {currentPlayerTypeTurn}");
|
||||
var botPawnsDictForCurrentPlayer = botRuntimeMovementData[currentPlayerTypeTurn]; // set the data inside this dict
|
||||
@ -457,7 +452,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
Debug.Log($"### AreAllPawnsInFinishingPath");
|
||||
if (AreAllPawnsInFinishingPath())
|
||||
{
|
||||
SetCanRollDiceForUser(!botTypesInGame.Contains(currentPlayerTypeTurn));
|
||||
SetCanRollDiceForUser(true);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -805,6 +800,10 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
}
|
||||
|
||||
SwitchPlayer(playerPawn);
|
||||
if (!CanRollDiceAgain)
|
||||
{
|
||||
SetCanRollDiceForUser(true);
|
||||
}
|
||||
}
|
||||
},
|
||||
index);
|
||||
@ -926,19 +925,20 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
CanRollDiceAgain = true;
|
||||
if (playerPawn.IsBotPlayer)
|
||||
CheckDiceRollForBot(playerPawn);
|
||||
else
|
||||
SetCanRollDiceForUser(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CheckForMaxDiceRollAttempt())
|
||||
{
|
||||
SetCanRollDiceForUser(true);
|
||||
return;
|
||||
}
|
||||
|
||||
SwitchPlayer();
|
||||
}
|
||||
|
||||
SetCanRollDiceForUser(true);
|
||||
}
|
||||
},
|
||||
index);
|
||||
@ -946,7 +946,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
|
||||
private void SetCanRollDiceForUser(bool state)
|
||||
{
|
||||
// if (botTypesInGame.Contains(playerType)) return;
|
||||
|
||||
CanRollDiceForUser = state;
|
||||
Debug.Log($"CAnRollDiceForUser: {CanRollDiceForUser}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,11 +34,11 @@ public class DiceRollHandler : MonoBehaviour
|
||||
{
|
||||
if (!inputManager.GameplayManager.CanRollDiceForUser) return;
|
||||
|
||||
diceView.Roll(onComplete: (rolledVal) => OnUserDiceRollComplete(rolledVal), false);
|
||||
diceView.Roll(onComplete: (rolledVal) => OnUserDiceRollComplete(rolledVal));
|
||||
}
|
||||
|
||||
public void HandleDiceViewForBot(Action<int> onComplete)
|
||||
{
|
||||
diceView.Roll(onComplete: (val) => onComplete?.Invoke(val), true);
|
||||
diceView.Roll(onComplete: onComplete);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user