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()
|
public void InitCurrentGamePlayerInfo()
|
||||||
{
|
{
|
||||||
currentPlayerTypeTurn = allPlayerTypes[currentPlayerTurnIndex];
|
currentPlayerTypeTurn = allPlayerTypes[currentPlayerTurnIndex];
|
||||||
|
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn);
|
||||||
Debug.Log($"currentPlayerTypeTurn: {currentPlayerTypeTurn}");
|
Debug.Log($"currentPlayerTypeTurn: {currentPlayerTypeTurn}");
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
|||||||
@ -24,7 +24,7 @@ public class PlayerBase : MonoBehaviour
|
|||||||
{
|
{
|
||||||
for (int idx = 0; idx < basePlacementDatas.Length; idx++)
|
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 Animator animator;
|
||||||
[SerializeField] private PlayerCountCanvas playerCountCanvas;
|
[SerializeField] private PlayerCountCanvas playerCountCanvas;
|
||||||
|
|
||||||
public PlayerCountCanvas PlayerCountCanvas => playerCountCanvas;
|
private PlayerBase playerBase;
|
||||||
|
|
||||||
public bool CanSelectPlayer
|
|
||||||
{
|
|
||||||
get; private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
private GameplayManager gameplayManager;
|
private GameplayManager gameplayManager;
|
||||||
|
|
||||||
public int CurrentTileIndex
|
public PlayerCountCanvas PlayerCountCanvas => playerCountCanvas;
|
||||||
{
|
|
||||||
get; private set;
|
public int PlayerId { get; private set; }
|
||||||
}
|
public int StepsTaken { get; private set; }
|
||||||
|
public int CurrentTileIndex { get; private set; }
|
||||||
public int PlayerId
|
public bool IsBotPlayer { get; private set; }
|
||||||
{
|
public bool CanSelectPlayer { get; private set; }
|
||||||
get; private set;
|
public PlayerType PlayerType { get; private set; }
|
||||||
}
|
|
||||||
|
|
||||||
public PlayerType PlayerType
|
|
||||||
{
|
|
||||||
get; private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsBotPlayer
|
|
||||||
{
|
|
||||||
get; private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int StepsTaken
|
|
||||||
{
|
|
||||||
get; private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AssignBotPlayerState(bool state)
|
public void AssignBotPlayerState(bool state)
|
||||||
{
|
{
|
||||||
@ -120,8 +98,14 @@ public class PlayerPawn : MonoBehaviour
|
|||||||
// transform.LookAt(transform.position + lookDirection);
|
// transform.LookAt(transform.position + lookDirection);
|
||||||
transform.DOLookAt(transform.position + lookDirection, 0.2f);
|
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.position = transformData.position;
|
||||||
transform.rotation = transformData.rotation;
|
transform.rotation = transformData.rotation;
|
||||||
SetPlayerState(PlayerState.InHome);
|
SetPlayerState(PlayerState.InHome);
|
||||||
|
ShowPlayerCountCanvas(false);
|
||||||
StepsTaken = 0;
|
StepsTaken = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,8 +145,9 @@ public class PlayerPawn : MonoBehaviour
|
|||||||
gameplayManager = gameplayManager ?? InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
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;
|
PlayerId = basePlacementData.playerBaseId;
|
||||||
PlayerType = playerType;
|
PlayerType = playerType;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user