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);
|
transform.localPosition = new Vector3(0, 20, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Roll(Action<int> onComplete, bool isBot)
|
public void Roll(Action<int> onComplete)
|
||||||
{
|
{
|
||||||
if (!rolling)
|
if (!rolling)
|
||||||
{
|
{
|
||||||
Debug.Log($"isBot: {isBot}");
|
|
||||||
onRollingComplete = onComplete;
|
onRollingComplete = onComplete;
|
||||||
StartCoroutine(RollRoutine());
|
StartCoroutine(RollRoutine());
|
||||||
}
|
}
|
||||||
@ -97,12 +96,5 @@ public class DiceView : MonoBehaviour, IBase
|
|||||||
rb.angularVelocity = Vector3.zero;
|
rb.angularVelocity = Vector3.zero;
|
||||||
transform.localPosition = new Vector3(0, 20, 0);
|
transform.localPosition = new Vector3(0, 20, 0);
|
||||||
rolling = false;
|
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>();
|
tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
|
||||||
|
|
||||||
|
CanRollDiceForUser = true;
|
||||||
|
|
||||||
InitPlayerTypesForBotMatch(PlayerType.Player1, 3);
|
InitPlayerTypesForBotMatch(PlayerType.Player1, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,8 +109,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
playerBaseHandler.InitPlayerTypes(allPlayerTypes);
|
playerBaseHandler.InitPlayerTypes(allPlayerTypes);
|
||||||
InitCurrentGamePlayerInfo();
|
InitCurrentGamePlayerInfo();
|
||||||
|
|
||||||
SetCanRollDiceForUser(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitPlayerTypesForBotMatch(PlayerType selectedPlayerType, int botCount)
|
public void InitPlayerTypesForBotMatch(PlayerType selectedPlayerType, int botCount)
|
||||||
@ -124,8 +124,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
InitCurrentGamePlayerInfo();
|
InitCurrentGamePlayerInfo();
|
||||||
InitBotRuntimeData();
|
InitBotRuntimeData();
|
||||||
AssignPlayerAndBotStates(selectedPlayerType);
|
AssignPlayerAndBotStates(selectedPlayerType);
|
||||||
|
|
||||||
SetCanRollDiceForUser(!botTypesInGame.Contains(selectedPlayerType));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitBotRuntimeData()
|
private void InitBotRuntimeData()
|
||||||
@ -246,6 +244,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
{
|
{
|
||||||
Debug.Log($"Switching player");
|
Debug.Log($"Switching player");
|
||||||
SwitchPlayer();
|
SwitchPlayer();
|
||||||
|
SetCanRollDiceForUser(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,11 +276,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
// What happens when you get a 6
|
// What happens when you get a 6
|
||||||
private void SelectPawnFromBotBase()
|
private void SelectPawnFromBotBase()
|
||||||
{
|
{
|
||||||
if (canSwitchPlayer || availPlayers.Count() < 1 && !CanRollDiceAgain || !botTypesInGame.Contains(currentPlayerTypeTurn))
|
if (canSwitchPlayer || availPlayers.Count() < 1 && !CanRollDiceAgain || !botTypesInGame.Contains(currentPlayerTypeTurn)) return; // Have a better check here
|
||||||
{
|
|
||||||
Debug.Log($"returning from SelectPawnFromBotBase");
|
|
||||||
return; // Have a better check here
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Log($"CallTest: SelectPawnFromBotBase: {currentPlayerTypeTurn}");
|
Debug.Log($"CallTest: SelectPawnFromBotBase: {currentPlayerTypeTurn}");
|
||||||
var botPawnsDictForCurrentPlayer = botRuntimeMovementData[currentPlayerTypeTurn]; // set the data inside this dict
|
var botPawnsDictForCurrentPlayer = botRuntimeMovementData[currentPlayerTypeTurn]; // set the data inside this dict
|
||||||
@ -457,7 +452,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
Debug.Log($"### AreAllPawnsInFinishingPath");
|
Debug.Log($"### AreAllPawnsInFinishingPath");
|
||||||
if (AreAllPawnsInFinishingPath())
|
if (AreAllPawnsInFinishingPath())
|
||||||
{
|
{
|
||||||
SetCanRollDiceForUser(!botTypesInGame.Contains(currentPlayerTypeTurn));
|
SetCanRollDiceForUser(true);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -805,6 +800,10 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
SwitchPlayer(playerPawn);
|
SwitchPlayer(playerPawn);
|
||||||
|
if (!CanRollDiceAgain)
|
||||||
|
{
|
||||||
|
SetCanRollDiceForUser(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
index);
|
index);
|
||||||
@ -925,20 +924,21 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
{
|
{
|
||||||
CanRollDiceAgain = true;
|
CanRollDiceAgain = true;
|
||||||
if (playerPawn.IsBotPlayer)
|
if (playerPawn.IsBotPlayer)
|
||||||
CheckDiceRollForBot(playerPawn);
|
CheckDiceRollForBot(playerPawn);
|
||||||
else
|
|
||||||
SetCanRollDiceForUser(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (CheckForMaxDiceRollAttempt())
|
if (CheckForMaxDiceRollAttempt())
|
||||||
{
|
{
|
||||||
|
SetCanRollDiceForUser(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SwitchPlayer();
|
SwitchPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetCanRollDiceForUser(true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
index);
|
index);
|
||||||
@ -946,7 +946,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
private void SetCanRollDiceForUser(bool state)
|
private void SetCanRollDiceForUser(bool state)
|
||||||
{
|
{
|
||||||
|
// if (botTypesInGame.Contains(playerType)) return;
|
||||||
|
|
||||||
CanRollDiceForUser = state;
|
CanRollDiceForUser = state;
|
||||||
Debug.Log($"CAnRollDiceForUser: {CanRollDiceForUser}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,11 +34,11 @@ public class DiceRollHandler : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (!inputManager.GameplayManager.CanRollDiceForUser) return;
|
if (!inputManager.GameplayManager.CanRollDiceForUser) return;
|
||||||
|
|
||||||
diceView.Roll(onComplete: (rolledVal) => OnUserDiceRollComplete(rolledVal), false);
|
diceView.Roll(onComplete: (rolledVal) => OnUserDiceRollComplete(rolledVal));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleDiceViewForBot(Action<int> onComplete)
|
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