using System; using System.Collections.Generic; using Sirenix.OdinInspector; using UnityEngine; // ReSharper disable once CheckNamespace namespace BlueWaterProject { [Serializable] public class Unit { [field: Tooltip("부대의 이름 또는 영웅의 이름")] [field: SerializeField] public string UnitName { get; set; } [field: Tooltip("부대의 종류")] [field: OnValueChanged("AttackerTypeAutoSetting")] [field: SerializeField] public GlobalValue.UnitType UnitType { get; set; } [field: Tooltip("부대의 병력 수")] [field: SerializeField] public int SoliderCount { get; set; } [field: DisableInEditorMode] [field: EnumToggleButtons] [field: SerializeField] public AttackerType AttackerType { get; set; } [field: ShowIf("AttackerType", AttackerType.OFFENSE)] [field: SerializeField] public OffenseType OffenseType { get; set; } [field: ShowIf("AttackerType", AttackerType.DEFENSE)] [field: SerializeField] public DefenseType DefenseType { get; set; } [field: Tooltip("부대 병력 리스트")] public List soldierList; public Unit() { UnitName = null; UnitType = GlobalValue.UnitType.NONE; SoliderCount = 0; soldierList = new List(); } public Unit(string unitName, GlobalValue.UnitType unitType, int soliderCount, List soldierList) { this.UnitName = unitName; this.UnitType = unitType; this.SoliderCount = soliderCount; this.soldierList = new List(this.SoliderCount); this.soldierList = soldierList; } public void AttackerTypeAutoSetting() { if (UnitType.ToString().Contains("_E")) { AttackerType = AttackerType.DEFENSE; } else if (UnitType.ToString().Contains("_P")) { AttackerType = AttackerType.OFFENSE; } else { AttackerType = AttackerType.NONE; } } public void SetAttackerType(AttackerType type) => AttackerType = type; public void SetOffenseType(OffenseType type) => OffenseType = type; public void SetDefenseType(DefenseType type) => DefenseType = type; } }