103 lines
3.6 KiB
C#
103 lines
3.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
namespace BlueWaterProject
|
|
{
|
|
[Serializable]
|
|
public class Unit : IIdx
|
|
{
|
|
#region Property and variable
|
|
|
|
[field: Tooltip("고유 인덱스")]
|
|
[field: SerializeField] public string Idx { get; set; }
|
|
|
|
[field: Tooltip("선장의 인덱스")]
|
|
[field: SerializeField] public string CaptainStatIdx { get; set; }
|
|
|
|
[field: Tooltip("선원의 인덱스")]
|
|
[field: SerializeField] public string SailorStatIdx { get; set; }
|
|
|
|
[field: Tooltip("부대의 이름 또는 선장의 이름")]
|
|
[field: SerializeField] public string UnitName { get; set; }
|
|
|
|
[field: Tooltip("부대의 종류")]
|
|
[field: DisableIf("@true")]
|
|
[field: SerializeField] public GlobalValue.UnitType UnitType { get; set; }
|
|
|
|
[field: Tooltip("선원의 수")]
|
|
[field: Range(0, GlobalValue.ONE_UNIT_CAPACITY - 1)]
|
|
[field: SerializeField] public int SailorCount { get; set; }
|
|
|
|
[field: EnumToggleButtons]
|
|
[field: DisableIf("@UnitType.ToString().Contains(\"_P\")")]
|
|
[field: SerializeField] public EAttackerType AttackerType { get; set; }
|
|
|
|
[field: EnumToggleButtons]
|
|
[field: SerializeField] public EOffenseType OffenseType { get; set; }
|
|
|
|
[field: EnumToggleButtons]
|
|
[field: SerializeField] public EDefenseType DefenseType { get; set; }
|
|
|
|
[field: Tooltip("부대 병력 리스트")]
|
|
[field: SerializeField] public List<AiController> UnitList { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
public Unit()
|
|
{
|
|
Idx = null;
|
|
CaptainStatIdx = null;
|
|
SailorStatIdx = null;
|
|
UnitName = null;
|
|
UnitType = GlobalValue.UnitType.NONE;
|
|
SailorCount = 0;
|
|
AttackerType = EAttackerType.NONE;
|
|
OffenseType = EOffenseType.NONE;
|
|
DefenseType = EDefenseType.NONE;
|
|
UnitList = new List<AiController>(GlobalValue.ONE_UNIT_CAPACITY);
|
|
}
|
|
|
|
public Unit(string idx, string captainIdx, string sailorIdx, string unitName,
|
|
int sailorCount, EAttackerType attackerType, EOffenseType offenseType, EDefenseType defenseType, List<AiController> unitList)
|
|
{
|
|
Idx = idx;
|
|
CaptainStatIdx = captainIdx;
|
|
SailorStatIdx = sailorIdx;
|
|
UnitName = unitName;
|
|
SailorCount = sailorCount;
|
|
OffenseType = offenseType;
|
|
DefenseType = defenseType;
|
|
UnitList = unitList;
|
|
|
|
UnitType = Application.isPlaying ? DataManager.Inst.GetAiStatDictionaryKey(CaptainStatIdx).UnitType :
|
|
DataManager.Inst.GetAiStatSoKey(CaptainStatIdx).UnitType;
|
|
|
|
if (AttackerType == EAttackerType.NONE) return;
|
|
|
|
AttackerType = attackerType;
|
|
}
|
|
|
|
public Unit(Unit unit)
|
|
{
|
|
Idx = unit.Idx;
|
|
CaptainStatIdx = unit.CaptainStatIdx;
|
|
SailorStatIdx = unit.SailorStatIdx;
|
|
UnitName = unit.UnitName;
|
|
SailorCount = unit.SailorCount;
|
|
AttackerType = unit.AttackerType;
|
|
OffenseType = unit.OffenseType;
|
|
DefenseType = unit.DefenseType;
|
|
UnitList = unit.UnitList;
|
|
|
|
UnitType = Application.isPlaying ? DataManager.Inst.GetAiStatDictionaryKey(CaptainStatIdx).UnitType :
|
|
DataManager.Inst.GetAiStatSoKey(CaptainStatIdx).UnitType;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |