64 lines
1.8 KiB
C#
Raw Normal View History

2026-01-21 20:27:45 +05:30
using UnityEngine;
2026-01-23 12:46:59 +05:30
using System.Collections.Generic;
[System.Serializable]
public class PlayerPlacementData
{
public PlayerPawn pawn;
}
2026-01-21 20:27:45 +05:30
[System.Serializable]
public class PlayerTileData
{
public int playerCount;
2026-01-23 12:46:59 +05:30
public Transform commonPlacementTransform;
public Dictionary<int, PlayerPawn> playerPawns;
}
2026-01-21 20:27:45 +05:30
public class Tile : MonoBehaviour
{
2026-01-23 12:46:59 +05:30
[SerializeField] protected bool isSafeZone = false;
2026-01-28 16:57:27 +05:30
[SerializeField] protected Transform centeredPoint;
2026-01-21 20:27:45 +05:30
public bool IsSafeZone => isSafeZone;
2026-01-28 16:57:27 +05:30
public Vector3 CenterPlacementPosition => centeredPoint.position;
private List<PlayerPawn> PlayerPawns = new List<PlayerPawn>(); // Change implementation
2026-02-02 15:10:51 +05:30
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;
}
2026-01-26 19:48:55 +05:30
public virtual void InitPlayerPawn(PlayerPawn playerPawn, PlayerType playerType)
2026-01-21 20:27:45 +05:30
{
PlayerPawns.Add(playerPawn);
Debug.Log($"Adding new PlayerPawn {playerPawn.name}, playerType: {playerType} to {name}");
Debug.Log($"Adding new PlayerPawn {PlayerPawns.Count} {name}");
2026-01-21 20:27:45 +05:30
}
2026-01-26 13:03:50 +05:30
public void ResetPlayerPawn(PlayerPawn movingPawn)
2026-01-26 13:03:50 +05:30
{
PlayerPawns.Remove(movingPawn);
Debug.Log($"Resetting new PlayerPawn {movingPawn.name} {name}");
Debug.Log($"Resetting new PlayerPawn {PlayerPawns.Count} {name}");
2026-01-26 13:03:50 +05:30
}
2026-02-02 19:27:17 +05:30
public virtual void ResetTileData()
{
Debug.Log($"Resetting tile in parent tile {name}");
2026-02-02 19:27:17 +05:30
if (HasPawnsAvailable)
PlayerPawns.Clear();
}
2026-01-21 20:27:45 +05:30
}