45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using UnityEngine;
|
|
|
|
[System.Serializable]
|
|
public class BasePlacementData
|
|
{
|
|
public int playerBaseId;
|
|
public Transform placementTransform;
|
|
}
|
|
|
|
public class PlayerBase : MonoBehaviour
|
|
{
|
|
[SerializeField] private PlayerType playerType;
|
|
[SerializeField] private BasePlacementData[] basePlacementDatas;
|
|
[SerializeField] private PlayerPawn[] playerPawns;
|
|
|
|
public bool IsBotBase
|
|
{
|
|
get; private set;
|
|
}
|
|
|
|
public PlayerType GetPlayerType() => playerType;
|
|
|
|
public void InitPlayerData()
|
|
{
|
|
for (int idx = 0; idx < basePlacementDatas.Length; idx++)
|
|
{
|
|
playerPawns[idx].Init(basePlacementDatas[idx].playerBaseId, playerType);
|
|
}
|
|
}
|
|
|
|
public void AssignBotState(PawnType pawnType)
|
|
{
|
|
IsBotBase = pawnType == PawnType.Bot;
|
|
for (int idx = 0; idx < playerPawns.Length; idx++)
|
|
{
|
|
playerPawns[idx].AssignBotPlayerState(IsBotBase);
|
|
}
|
|
}
|
|
|
|
public Transform GetBasePlacementDataPosition(int idx)
|
|
{
|
|
return basePlacementDatas[idx].placementTransform;
|
|
}
|
|
}
|