2026-01-21 20:27:45 +05:30
|
|
|
using UnityEngine;
|
|
|
|
|
|
2026-01-23 15:32:48 +05:30
|
|
|
[System.Serializable]
|
|
|
|
|
public class BasePlacementData
|
|
|
|
|
{
|
|
|
|
|
public int playerBaseId;
|
|
|
|
|
public Transform placementTransform;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-11 19:53:16 +05:30
|
|
|
public class PlayerBase : MonoBehaviour, IRollBase
|
2026-01-21 20:27:45 +05:30
|
|
|
{
|
2026-01-26 19:48:55 +05:30
|
|
|
[SerializeField] private PlayerType playerType;
|
2026-01-23 15:32:48 +05:30
|
|
|
[SerializeField] private BasePlacementData[] basePlacementDatas;
|
|
|
|
|
[SerializeField] private PlayerPawn[] playerPawns;
|
2026-02-06 19:04:39 +05:30
|
|
|
[SerializeField] private GameObject playerBaseEffect;
|
2026-02-11 19:53:16 +05:30
|
|
|
|
|
|
|
|
private int sixRollCount, maxRollCount;
|
|
|
|
|
|
|
|
|
|
public int SixRollCount => sixRollCount;
|
|
|
|
|
public int MaxRollCount => maxRollCount;
|
2026-01-23 15:32:48 +05:30
|
|
|
|
2026-01-27 20:55:55 +05:30
|
|
|
public bool IsBotBase
|
|
|
|
|
{
|
|
|
|
|
get; private set;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-26 19:48:55 +05:30
|
|
|
public PlayerType GetPlayerType() => playerType;
|
2026-01-23 15:32:48 +05:30
|
|
|
|
2026-02-11 19:53:16 +05:30
|
|
|
public void UpdateSixRollCount()
|
|
|
|
|
{
|
|
|
|
|
sixRollCount++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ResetRollData()
|
|
|
|
|
{
|
|
|
|
|
sixRollCount = 0;
|
|
|
|
|
maxRollCount = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateMaxRollCount(int val)
|
|
|
|
|
{
|
|
|
|
|
maxRollCount = val;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-26 13:03:50 +05:30
|
|
|
public void InitPlayerData()
|
2026-01-21 20:27:45 +05:30
|
|
|
{
|
2026-01-23 15:32:48 +05:30
|
|
|
for (int idx = 0; idx < basePlacementDatas.Length; idx++)
|
|
|
|
|
{
|
2026-02-06 14:06:52 +05:30
|
|
|
playerPawns[idx].Init(this, basePlacementDatas[idx], playerType);
|
2026-01-23 15:32:48 +05:30
|
|
|
}
|
2026-01-21 20:27:45 +05:30
|
|
|
}
|
|
|
|
|
|
2026-01-27 20:55:55 +05:30
|
|
|
public void AssignBotState(PawnType pawnType)
|
|
|
|
|
{
|
|
|
|
|
IsBotBase = pawnType == PawnType.Bot;
|
|
|
|
|
for (int idx = 0; idx < playerPawns.Length; idx++)
|
|
|
|
|
{
|
|
|
|
|
playerPawns[idx].AssignBotPlayerState(IsBotBase);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-26 13:03:50 +05:30
|
|
|
public Transform GetBasePlacementDataPosition(int idx)
|
2026-01-21 20:27:45 +05:30
|
|
|
{
|
2026-01-29 18:13:07 +05:30
|
|
|
Debug.Log($"Index: {idx}, basePlacementDatas[idx]: {basePlacementDatas[idx]}");
|
2026-01-26 13:03:50 +05:30
|
|
|
return basePlacementDatas[idx].placementTransform;
|
2026-01-21 20:27:45 +05:30
|
|
|
}
|
2026-02-02 19:27:17 +05:30
|
|
|
|
|
|
|
|
public void ResetPlayerDatas()
|
|
|
|
|
{
|
|
|
|
|
for (int idx = 0; idx < playerPawns.Length; idx++)
|
|
|
|
|
{
|
|
|
|
|
playerPawns[idx].ResetData();
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-02-06 19:04:39 +05:30
|
|
|
|
|
|
|
|
public void ShowPlayerBaseEffect(bool state)
|
|
|
|
|
{
|
|
|
|
|
playerBaseEffect.SetActive(state);
|
|
|
|
|
}
|
2026-01-21 20:27:45 +05:30
|
|
|
}
|