Fix: Data when reaching finishing point.
This commit is contained in:
parent
f93ba98ef3
commit
5afd8972fc
@ -319,7 +319,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome == 0)
|
if (playerGameDatasDict[currentPlayerTypeTurn].totalPawnsInHome == 0)
|
||||||
{
|
{
|
||||||
UpdateActivePlayersAndSetDisplay();
|
UpdateActivePlayersAndSetDisplay(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (availPlayers.Count() < 1 && CanRollDiceAgain) // got a 6 roll value
|
if (availPlayers.Count() < 1 && CanRollDiceAgain) // got a 6 roll value
|
||||||
@ -522,7 +522,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
else // if there are any other pawns that are in safe or moving state
|
else // if there are any other pawns that are in safe or moving state
|
||||||
{
|
{
|
||||||
// for player's logic
|
// for player's logic
|
||||||
UpdateActivePlayersAndSetDisplay();
|
UpdateActivePlayersAndSetDisplay(true);
|
||||||
|
|
||||||
int customAvailPlayers = availPlayers.Count();
|
int customAvailPlayers = availPlayers.Count();
|
||||||
Debug.Log($"before CustomAvailablePlayers: {customAvailPlayers}");
|
Debug.Log($"before CustomAvailablePlayers: {customAvailPlayers}");
|
||||||
@ -564,14 +564,14 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
Debug.Log($"CanRollDiceAgain: {CanRollDiceAgain}, canSwitchPlayer: {canSwitchPlayer}");
|
Debug.Log($"CanRollDiceAgain: {CanRollDiceAgain}, canSwitchPlayer: {canSwitchPlayer}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateActivePlayersAndSetDisplay()
|
private void UpdateActivePlayersAndSetDisplay(bool state)
|
||||||
{
|
{
|
||||||
availPlayers = playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values.Select(pawn => pawn)
|
availPlayers = playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values.Select(pawn => pawn)
|
||||||
.Where(pawn => pawn.GetPlayerState() == PlayerState.InSafeZone ||
|
.Where(pawn => pawn.GetPlayerState() == PlayerState.InSafeZone ||
|
||||||
pawn.GetPlayerState() == PlayerState.Moving ||
|
pawn.GetPlayerState() == PlayerState.Moving ||
|
||||||
pawn.GetPlayerState() == PlayerState.InFinishingPath).ToList();
|
pawn.GetPlayerState() == PlayerState.InFinishingPath).ToList();
|
||||||
|
|
||||||
SetDisplayCountForAllAvailPlayers(true);
|
SetDisplayCountForAllAvailPlayers(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool AreAllPawnsInFinishingPath()
|
private bool AreAllPawnsInFinishingPath()
|
||||||
@ -756,9 +756,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
Debug.Log($"before SwitchPlayer availPlayers: {availPlayers.Count}, playerPawn: {playerPawn}");
|
Debug.Log($"before SwitchPlayer availPlayers: {availPlayers.Count}, playerPawn: {playerPawn}");
|
||||||
|
|
||||||
UpdateActivePlayersAndSetDisplay();
|
UpdateActivePlayersAndSetDisplay(false);
|
||||||
Debug.Log($"after SwitchPlayer availPlayers: {availPlayers.Count}, playerPawn: {playerPawn}");
|
Debug.Log($"after SwitchPlayer availPlayers: {availPlayers.Count}, playerPawn: {playerPawn}");
|
||||||
SetDisplayCountForAllAvailPlayers(false);
|
|
||||||
|
|
||||||
if (allPlayerTypes.Count == 1)
|
if (allPlayerTypes.Count == 1)
|
||||||
{
|
{
|
||||||
@ -784,7 +783,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
diceSixRollCounter = 0;
|
diceSixRollCounter = 0;
|
||||||
diceText.text = $"{0}";
|
diceText.text = $"{0}";
|
||||||
|
|
||||||
UpdateActivePlayersAndSetDisplay();
|
UpdateActivePlayersAndSetDisplay(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"CurrentPlayerTurn: {currentPlayerTypeTurn}");
|
Debug.Log($"CurrentPlayerTurn: {currentPlayerTypeTurn}");
|
||||||
@ -1107,7 +1106,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|||||||
|
|
||||||
foreach (var pawn in pawns)
|
foreach (var pawn in pawns)
|
||||||
{
|
{
|
||||||
if (pawn.GetPlayerState() == PlayerState.InHome || pawn.GetPlayerState() == PlayerState.HasFinished) continue;
|
if (pawn.GetPlayerState() == PlayerState.InHome) continue;
|
||||||
|
|
||||||
tilesManager.ResetTileData(pawn.PlayerType, pawn.CurrentTileIndex, pawn.GetPlayerState());
|
tilesManager.ResetTileData(pawn.PlayerType, pawn.CurrentTileIndex, pawn.GetPlayerState());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,7 +69,7 @@ public class TilesManager : MonoBehaviour, IBootLoader, IDataLoader, IBase
|
|||||||
|
|
||||||
public void ResetTileData(PlayerType playerType, int currentTileIndex, PlayerState playerState)
|
public void ResetTileData(PlayerType playerType, int currentTileIndex, PlayerState playerState)
|
||||||
{
|
{
|
||||||
if (playerState == PlayerState.InFinishingPath)
|
if (playerState == PlayerState.InFinishingPath || playerState == PlayerState.HasFinished)
|
||||||
{
|
{
|
||||||
Tile tile = RetrieveFinishingTileBasedOnIndex(playerType, currentTileIndex);
|
Tile tile = RetrieveFinishingTileBasedOnIndex(playerType, currentTileIndex);
|
||||||
tile.ResetTileData();
|
tile.ResetTileData();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user