Fixed restart issue while game's being played.
This commit is contained in:
parent
ae15daed75
commit
06821c0030
@ -234,6 +234,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
public void InitCurrentGamePlayerInfo()
|
||||
{
|
||||
currentPlayerTypeTurn = allPlayerTypes[currentPlayerTurnIndex];
|
||||
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn);
|
||||
Debug.Log($"currentPlayerTypeTurn: {currentPlayerTypeTurn}");
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
||||
@ -24,7 +24,7 @@ public class PlayerBase : MonoBehaviour
|
||||
{
|
||||
for (int idx = 0; idx < basePlacementDatas.Length; idx++)
|
||||
{
|
||||
playerPawns[idx].Init(basePlacementDatas[idx], playerType);
|
||||
playerPawns[idx].Init(this, basePlacementDatas[idx], playerType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -23,39 +23,17 @@ public class PlayerPawn : MonoBehaviour
|
||||
[SerializeField] private Animator animator;
|
||||
[SerializeField] private PlayerCountCanvas playerCountCanvas;
|
||||
|
||||
public PlayerCountCanvas PlayerCountCanvas => playerCountCanvas;
|
||||
|
||||
public bool CanSelectPlayer
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
private PlayerBase playerBase;
|
||||
private GameplayManager gameplayManager;
|
||||
|
||||
public int CurrentTileIndex
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public PlayerCountCanvas PlayerCountCanvas => playerCountCanvas;
|
||||
|
||||
public int PlayerId
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public PlayerType PlayerType
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public bool IsBotPlayer
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public int StepsTaken
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public int PlayerId { get; private set; }
|
||||
public int StepsTaken { get; private set; }
|
||||
public int CurrentTileIndex { get; private set; }
|
||||
public bool IsBotPlayer { get; private set; }
|
||||
public bool CanSelectPlayer { get; private set; }
|
||||
public PlayerType PlayerType { get; private set; }
|
||||
|
||||
public void AssignBotPlayerState(bool state)
|
||||
{
|
||||
@ -121,7 +99,13 @@ public class PlayerPawn : MonoBehaviour
|
||||
transform.DOLookAt(transform.position + lookDirection, 0.2f);
|
||||
}
|
||||
|
||||
onComplete?.Invoke();
|
||||
Debug.Log($"Dotween:: MoveToTile.OnComplete {PlayerType}, {transform.position}: {StepsTaken != 0}");
|
||||
if (StepsTaken != 0)
|
||||
onComplete?.Invoke();
|
||||
else
|
||||
{
|
||||
transform.position = playerBase.GetBasePlacementDataPosition(PlayerId - 1).position;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -137,6 +121,7 @@ public class PlayerPawn : MonoBehaviour
|
||||
transform.position = transformData.position;
|
||||
transform.rotation = transformData.rotation;
|
||||
SetPlayerState(PlayerState.InHome);
|
||||
ShowPlayerCountCanvas(false);
|
||||
StepsTaken = 0;
|
||||
}
|
||||
|
||||
@ -160,8 +145,9 @@ public class PlayerPawn : MonoBehaviour
|
||||
gameplayManager = gameplayManager ?? InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
||||
}
|
||||
|
||||
public void Init(BasePlacementData basePlacementData, PlayerType playerType)
|
||||
public void Init(PlayerBase playerBase, BasePlacementData basePlacementData, PlayerType playerType)
|
||||
{
|
||||
this.playerBase = playerBase;
|
||||
PlayerId = basePlacementData.playerBaseId;
|
||||
PlayerType = playerType;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user