57 lines
1.6 KiB
C#

using UnityEngine;
using System.Collections.Generic;
[System.Serializable]
public class PlayerPlacementData
{
public PlayerPawn pawn;
}
[System.Serializable]
public class PlayerTileData
{
public int playerCount;
public Transform commonPlacementTransform;
public Dictionary<int, PlayerPawn> playerPawns;
}
public class Tile : MonoBehaviour
{
[SerializeField] protected bool isSafeZone = false;
[SerializeField] protected Transform centeredPoint;
public bool IsSafeZone => isSafeZone;
public Vector3 CenterPlacementPosition => centeredPoint.position;
private List<PlayerPawn> PlayerPawns = new List<PlayerPawn>(); // Change implementation
public List<PlayerPawn> GetPlayerPawns() => PlayerPawns;
public bool HasPawnsAvailable => PlayerPawns.Count > 0;
public PlayerType CurrentHoldingPlayerType => PlayerPawns[0].PlayerType;
public int TotalPawnsInTile => PlayerPawns.Count;
public PlayerPawn GetPlayerPawn()
{
var pawn = PlayerPawns[0];
PlayerPawns.RemoveAt(0);
return pawn;
}
public virtual void InitPlayerPawn(PlayerPawn playerPawn, PlayerType playerType)
{
PlayerPawns.Add(playerPawn);
Debug.Log($"Adding new PlayerPawn {playerPawn.name}, playerType: {playerType} to {name}");
Debug.Log($"Adding new PlayerPawn {PlayerPawns.Count} {name}");
}
public void ResetPlayerPawn(PlayerPawn movingPawn)
{
PlayerPawns.Remove(movingPawn);
Debug.Log($"Resetting new PlayerPawn {movingPawn.name} {name}");
Debug.Log($"Resetting new PlayerPawn {PlayerPawns.Count} {name}");
}
}