#28 유닛 생성 방식 변경 중2
This commit is contained in:
parent
ea170ca058
commit
4ed3453f3b
@ -2041,6 +2041,37 @@ MonoBehaviour:
|
|||||||
groundLayer:
|
groundLayer:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 8
|
m_Bits: 8
|
||||||
|
--- !u!1 &285433280
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 285433281}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PlayerUnits
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &285433281
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 285433280}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1001 &298893684
|
--- !u!1001 &298893684
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -9556,6 +9587,7 @@ MonoBehaviour:
|
|||||||
<AiStat>k__BackingField:
|
<AiStat>k__BackingField:
|
||||||
<Idx>k__BackingField:
|
<Idx>k__BackingField:
|
||||||
<ViewIdx>k__BackingField:
|
<ViewIdx>k__BackingField:
|
||||||
|
<AiType>k__BackingField: -1
|
||||||
<MaxHp>k__BackingField: 0
|
<MaxHp>k__BackingField: 0
|
||||||
<CurrentHp>k__BackingField: 0
|
<CurrentHp>k__BackingField: 0
|
||||||
<Atk>k__BackingField: 0
|
<Atk>k__BackingField: 0
|
||||||
@ -9567,6 +9599,8 @@ MonoBehaviour:
|
|||||||
<AvoidanceRate>k__BackingField: 0
|
<AvoidanceRate>k__BackingField: 0
|
||||||
<UsingShield>k__BackingField: 0
|
<UsingShield>k__BackingField: 0
|
||||||
<PenetrationResistivity>k__BackingField: 0
|
<PenetrationResistivity>k__BackingField: 0
|
||||||
|
<UsingBow>k__BackingField: 0
|
||||||
|
<Inaccuracy>k__BackingField: 0
|
||||||
--- !u!208 &1514637408
|
--- !u!208 &1514637408
|
||||||
NavMeshObstacle:
|
NavMeshObstacle:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -9754,6 +9788,7 @@ MonoBehaviour:
|
|||||||
<AiStat>k__BackingField:
|
<AiStat>k__BackingField:
|
||||||
<Idx>k__BackingField:
|
<Idx>k__BackingField:
|
||||||
<ViewIdx>k__BackingField:
|
<ViewIdx>k__BackingField:
|
||||||
|
<AiType>k__BackingField: -1
|
||||||
<MaxHp>k__BackingField: 0
|
<MaxHp>k__BackingField: 0
|
||||||
<CurrentHp>k__BackingField: 0
|
<CurrentHp>k__BackingField: 0
|
||||||
<Atk>k__BackingField: 0
|
<Atk>k__BackingField: 0
|
||||||
@ -9765,6 +9800,8 @@ MonoBehaviour:
|
|||||||
<AvoidanceRate>k__BackingField: 0
|
<AvoidanceRate>k__BackingField: 0
|
||||||
<UsingShield>k__BackingField: 0
|
<UsingShield>k__BackingField: 0
|
||||||
<PenetrationResistivity>k__BackingField: 0
|
<PenetrationResistivity>k__BackingField: 0
|
||||||
|
<UsingBow>k__BackingField: 0
|
||||||
|
<Inaccuracy>k__BackingField: 0
|
||||||
--- !u!208 &1545632334
|
--- !u!208 &1545632334
|
||||||
NavMeshObstacle:
|
NavMeshObstacle:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -12778,3 +12815,4 @@ SceneRoots:
|
|||||||
- {fileID: 1332541640}
|
- {fileID: 1332541640}
|
||||||
- {fileID: 979588904}
|
- {fileID: 979588904}
|
||||||
- {fileID: 1877670855}
|
- {fileID: 1877670855}
|
||||||
|
- {fileID: 285433281}
|
||||||
|
@ -116,54 +116,12 @@ namespace BlueWaterProject
|
|||||||
protected virtual void Awake()
|
protected virtual void Awake()
|
||||||
{
|
{
|
||||||
FindMaterial();
|
FindMaterial();
|
||||||
|
InitComponent();
|
||||||
backpackContainer = Utils.GetComponentAndAssert<Transform>(transform.
|
|
||||||
Find("Bip001/Bip001 Pelvis/Bip001 Spine/Backpack_container"));
|
|
||||||
leftWeaponContainer = Utils.GetComponentAndAssert<Transform>(transform.
|
|
||||||
Find("Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 L Clavicle/Bip001 L UpperArm/Bip001 L Forearm/Bip001 L Hand/L_hand_container"));
|
|
||||||
leftShieldContainer = Utils.GetComponentAndAssert<Transform>(transform.
|
|
||||||
Find("Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 L Clavicle/Bip001 L UpperArm/Bip001 L Forearm/Bip001 L Hand/L_shield_container"));
|
|
||||||
headContainer = Utils.GetComponentAndAssert<Transform>(transform.
|
|
||||||
Find("Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Neck/Bip001 Head/Head_container"));
|
|
||||||
rightWeaponContainer = Utils.GetComponentAndAssert<Transform>(transform.
|
|
||||||
Find("Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 R Clavicle/Bip001 R UpperArm/Bip001 R Forearm/Bip001 R Hand/R_hand_container"));
|
|
||||||
bodyContainer = Utils.GetComponentAndAssert<Transform>(transform.
|
|
||||||
Find("Body_container"));
|
|
||||||
flagContainer = Utils.GetComponentAndAssert<Transform>(transform.
|
|
||||||
Find("Flag_container"));
|
|
||||||
|
|
||||||
aiAnimator = Utils.GetComponentAndAssert<Animator>(transform);
|
|
||||||
navMeshAgent = Utils.GetComponentAndAssert<NavMeshAgent>(transform);
|
|
||||||
myUnitController = Utils.GetComponentAndAssert<UnitController>(transform.parent);
|
|
||||||
myCollider = Utils.GetComponentAndAssert<CapsuleCollider>(transform);
|
|
||||||
hitBoxCollider = Utils.GetComponentAndAssert<CapsuleCollider>(transform.Find("HitBox"));
|
|
||||||
unitSelection = FindObjectOfType<UnitSelection>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
switch (AiStat.AiType)
|
InitStart();
|
||||||
{
|
|
||||||
case AiType.NONE:
|
|
||||||
break;
|
|
||||||
case AiType.PLAYER:
|
|
||||||
gameObject.layer = LayerMask.NameToLayer("Player");
|
|
||||||
hitBoxCollider.gameObject.layer = LayerMask.NameToLayer("Player");
|
|
||||||
break;
|
|
||||||
case AiType.PIRATE:
|
|
||||||
gameObject.layer = LayerMask.NameToLayer("Pirate");
|
|
||||||
hitBoxCollider.gameObject.layer = LayerMask.NameToLayer("Pirate");
|
|
||||||
break;
|
|
||||||
case AiType.ENEMY:
|
|
||||||
gameObject.layer = LayerMask.NameToLayer("Enemy");
|
|
||||||
hitBoxCollider.gameObject.layer = LayerMask.NameToLayer("Enemy");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
}
|
|
||||||
InitViewModel();
|
|
||||||
SetCurrentHp(AiStat.MaxHp);
|
|
||||||
SetMoveSpeed(AiStat.MoveSpd);
|
|
||||||
|
|
||||||
switch (attackerType)
|
switch (attackerType)
|
||||||
{
|
{
|
||||||
@ -509,7 +467,40 @@ namespace BlueWaterProject
|
|||||||
|
|
||||||
#region Custom function
|
#region Custom function
|
||||||
|
|
||||||
public void InitViewModel()
|
private void InitComponent()
|
||||||
|
{
|
||||||
|
backpackContainer = Utils.GetComponentAndAssert<Transform>(transform.
|
||||||
|
Find("Bip001/Bip001 Pelvis/Bip001 Spine/Backpack_container"));
|
||||||
|
leftWeaponContainer = Utils.GetComponentAndAssert<Transform>(transform.
|
||||||
|
Find("Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 L Clavicle/Bip001 L UpperArm/Bip001 L Forearm/Bip001 L Hand/L_hand_container"));
|
||||||
|
leftShieldContainer = Utils.GetComponentAndAssert<Transform>(transform.
|
||||||
|
Find("Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 L Clavicle/Bip001 L UpperArm/Bip001 L Forearm/Bip001 L Hand/L_shield_container"));
|
||||||
|
headContainer = Utils.GetComponentAndAssert<Transform>(transform.
|
||||||
|
Find("Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Neck/Bip001 Head/Head_container"));
|
||||||
|
rightWeaponContainer = Utils.GetComponentAndAssert<Transform>(transform.
|
||||||
|
Find("Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 R Clavicle/Bip001 R UpperArm/Bip001 R Forearm/Bip001 R Hand/R_hand_container"));
|
||||||
|
bodyContainer = Utils.GetComponentAndAssert<Transform>(transform.
|
||||||
|
Find("Body_container"));
|
||||||
|
flagContainer = Utils.GetComponentAndAssert<Transform>(transform.
|
||||||
|
Find("Flag_container"));
|
||||||
|
|
||||||
|
aiAnimator = Utils.GetComponentAndAssert<Animator>(transform);
|
||||||
|
navMeshAgent = Utils.GetComponentAndAssert<NavMeshAgent>(transform);
|
||||||
|
myUnitController = Utils.GetComponentAndAssert<UnitController>(transform.parent);
|
||||||
|
myCollider = Utils.GetComponentAndAssert<CapsuleCollider>(transform);
|
||||||
|
hitBoxCollider = Utils.GetComponentAndAssert<CapsuleCollider>(transform.Find("HitBox"));
|
||||||
|
unitSelection = FindObjectOfType<UnitSelection>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitStart()
|
||||||
|
{
|
||||||
|
InitViewModel();
|
||||||
|
SetLayer();
|
||||||
|
SetCurrentHp(AiStat.MaxHp);
|
||||||
|
SetMoveSpeed(AiStat.MoveSpd);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitViewModel()
|
||||||
{
|
{
|
||||||
SetActiveViewModel(backpackContainer, DataManager.Inst.GetAiViewDictionaryKey(AiStat.ViewIdx).Backpack);
|
SetActiveViewModel(backpackContainer, DataManager.Inst.GetAiViewDictionaryKey(AiStat.ViewIdx).Backpack);
|
||||||
SetActiveViewModel(leftWeaponContainer, DataManager.Inst.GetAiViewDictionaryKey(AiStat.ViewIdx).LeftWeapon);
|
SetActiveViewModel(leftWeaponContainer, DataManager.Inst.GetAiViewDictionaryKey(AiStat.ViewIdx).LeftWeapon);
|
||||||
@ -526,6 +517,34 @@ namespace BlueWaterProject
|
|||||||
closeWeapon.SetAttackerType(attackerType);
|
closeWeapon.SetAttackerType(attackerType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
public void InitStartInEditor()
|
||||||
|
{
|
||||||
|
InitComponent();
|
||||||
|
InitViewModelInEditor();
|
||||||
|
SetLayer();
|
||||||
|
SetCurrentHp(AiStat.MaxHp);
|
||||||
|
SetMoveSpeed(AiStat.MoveSpd);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitViewModelInEditor()
|
||||||
|
{
|
||||||
|
SetActiveViewModel(backpackContainer, DataManager.Inst.GetAiViewSoKey(AiStat.ViewIdx).Backpack);
|
||||||
|
SetActiveViewModel(leftWeaponContainer, DataManager.Inst.GetAiViewSoKey(AiStat.ViewIdx).LeftWeapon);
|
||||||
|
SetActiveViewModel(leftShieldContainer, DataManager.Inst.GetAiViewSoKey(AiStat.ViewIdx).LeftShield);
|
||||||
|
SetActiveViewModel(headContainer, DataManager.Inst.GetAiViewSoKey(AiStat.ViewIdx).Head);
|
||||||
|
SetActiveViewModel(rightWeaponContainer, DataManager.Inst.GetAiViewSoKey(AiStat.ViewIdx).RightWeapon);
|
||||||
|
SetActiveViewModel(bodyContainer, DataManager.Inst.GetAiViewSoKey(AiStat.ViewIdx).Body);
|
||||||
|
SetActiveViewModel(flagContainer, DataManager.Inst.GetAiViewSoKey(AiStat.ViewIdx).Flag);
|
||||||
|
|
||||||
|
if (DataManager.Inst.GetAiViewSoKey(AiStat.ViewIdx).RightWeapon == -1) return;
|
||||||
|
|
||||||
|
closeWeapon = rightWeaponContainer.GetChild(DataManager.Inst.GetAiViewSoKey(AiStat.ViewIdx).RightWeapon).AddComponent<CloseWeapon>();
|
||||||
|
closeWeapon.gameObject.layer = LayerMask.NameToLayer("Weapon");
|
||||||
|
closeWeapon.SetAttackerType(attackerType);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private void SetActiveViewModel(Transform container, int model)
|
private void SetActiveViewModel(Transform container, int model)
|
||||||
{
|
{
|
||||||
foreach (Transform item in container)
|
foreach (Transform item in container)
|
||||||
@ -631,6 +650,32 @@ namespace BlueWaterProject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void SetLayer()
|
||||||
|
{
|
||||||
|
switch (AiStat.AiType)
|
||||||
|
{
|
||||||
|
case AiType.NONE:
|
||||||
|
break;
|
||||||
|
case AiType.PLAYER:
|
||||||
|
gameObject.layer = LayerMask.NameToLayer("Player");
|
||||||
|
hitBoxCollider.gameObject.layer = LayerMask.NameToLayer("Player");
|
||||||
|
TargetLayer = LayerMask.GetMask("Enemy");
|
||||||
|
break;
|
||||||
|
case AiType.PIRATE:
|
||||||
|
gameObject.layer = LayerMask.NameToLayer("Pirate");
|
||||||
|
hitBoxCollider.gameObject.layer = LayerMask.NameToLayer("Pirate");
|
||||||
|
TargetLayer = LayerMask.GetMask("Enemy");
|
||||||
|
break;
|
||||||
|
case AiType.ENEMY:
|
||||||
|
gameObject.layer = LayerMask.NameToLayer("Enemy");
|
||||||
|
hitBoxCollider.gameObject.layer = LayerMask.NameToLayer("Enemy");
|
||||||
|
TargetLayer = LayerMask.GetMask("Player") | LayerMask.GetMask("Pirate") | LayerMask.GetMask("Props");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetAttackerType(AttackerType type) => attackerType = type;
|
public void SetAttackerType(AttackerType type) => attackerType = type;
|
||||||
public void SetOffenseType(OffenseType type) => offenseType = type;
|
public void SetOffenseType(OffenseType type) => offenseType = type;
|
||||||
public void SetDefenseType(DefenseType type) => defenseType = type;
|
public void SetDefenseType(DefenseType type) => defenseType = type;
|
||||||
|
@ -29,11 +29,12 @@ namespace BlueWaterProject
|
|||||||
[field: Tooltip("선원의 수")]
|
[field: Tooltip("선원의 수")]
|
||||||
[field: Range(0, GlobalValue.ONE_UNIT_CAPACITY - 1)]
|
[field: Range(0, GlobalValue.ONE_UNIT_CAPACITY - 1)]
|
||||||
[field: SerializeField] public int SailorCount { get; set; }
|
[field: SerializeField] public int SailorCount { get; set; }
|
||||||
|
|
||||||
//[field: ShowIf("AttackerType", AttackerType.OFFENSE)]
|
[field: DisableIf("@true")]
|
||||||
|
[field: SerializeField] public AttackerType AttackerType { get; set; }
|
||||||
|
|
||||||
[field: SerializeField] public OffenseType OffenseType { get; set; }
|
[field: SerializeField] public OffenseType OffenseType { get; set; }
|
||||||
|
|
||||||
//[field: ShowIf("AttackerType", AttackerType.DEFENSE)]
|
|
||||||
[field: SerializeField] public DefenseType DefenseType { get; set; }
|
[field: SerializeField] public DefenseType DefenseType { get; set; }
|
||||||
|
|
||||||
[field: Tooltip("부대 병력 리스트")]
|
[field: Tooltip("부대 병력 리스트")]
|
||||||
@ -51,13 +52,14 @@ namespace BlueWaterProject
|
|||||||
UnitName = null;
|
UnitName = null;
|
||||||
UnitType = GlobalValue.UnitType.NONE;
|
UnitType = GlobalValue.UnitType.NONE;
|
||||||
SailorCount = 0;
|
SailorCount = 0;
|
||||||
|
AttackerType = AttackerType.NONE;
|
||||||
OffenseType = OffenseType.NONE;
|
OffenseType = OffenseType.NONE;
|
||||||
DefenseType = DefenseType.NONE;
|
DefenseType = DefenseType.NONE;
|
||||||
UnitList = new List<AiController>(GlobalValue.ONE_UNIT_CAPACITY);
|
UnitList = new List<AiController>(GlobalValue.ONE_UNIT_CAPACITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Unit(string idx, string captainIdx, string sailorIdx, string unitName, GlobalValue.UnitType unitType,
|
public Unit(string idx, string captainIdx, string sailorIdx, string unitName, GlobalValue.UnitType unitType,
|
||||||
int sailorCount, OffenseType offenseType, DefenseType defenseType, List<AiController> unitList)
|
int sailorCount, AttackerType attackerType, OffenseType offenseType, DefenseType defenseType, List<AiController> unitList)
|
||||||
{
|
{
|
||||||
Idx = idx;
|
Idx = idx;
|
||||||
CaptainStatIdx = captainIdx;
|
CaptainStatIdx = captainIdx;
|
||||||
@ -65,9 +67,12 @@ namespace BlueWaterProject
|
|||||||
UnitName = unitName;
|
UnitName = unitName;
|
||||||
UnitType = unitType;
|
UnitType = unitType;
|
||||||
SailorCount = sailorCount;
|
SailorCount = sailorCount;
|
||||||
|
AttackerType = attackerType;
|
||||||
OffenseType = offenseType;
|
OffenseType = offenseType;
|
||||||
DefenseType = defenseType;
|
DefenseType = defenseType;
|
||||||
UnitList = unitList;
|
UnitList = unitList;
|
||||||
|
|
||||||
|
//SetAttackerTypeUnitAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Unit(Unit unit)
|
public Unit(Unit unit)
|
||||||
@ -78,15 +83,25 @@ namespace BlueWaterProject
|
|||||||
UnitName = unit.UnitName;
|
UnitName = unit.UnitName;
|
||||||
UnitType = unit.UnitType;
|
UnitType = unit.UnitType;
|
||||||
SailorCount = unit.SailorCount;
|
SailorCount = unit.SailorCount;
|
||||||
|
AttackerType = unit.AttackerType;
|
||||||
OffenseType = unit.OffenseType;
|
OffenseType = unit.OffenseType;
|
||||||
DefenseType = unit.DefenseType;
|
DefenseType = unit.DefenseType;
|
||||||
UnitList = unit.UnitList;
|
UnitList = unit.UnitList;
|
||||||
|
|
||||||
|
//SetAttackerTypeUnitAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Custrom method
|
#region Custrom method
|
||||||
|
|
||||||
|
// private void SetAttackerTypeUnitAll()
|
||||||
|
// {
|
||||||
|
// foreach (var item in UnitList)
|
||||||
|
// {
|
||||||
|
// item.SetAttackerType(AttackerType);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
public void SetOffenseType(OffenseType type) => OffenseType = type;
|
public void SetOffenseType(OffenseType type) => OffenseType = type;
|
||||||
public void SetDefenseType(DefenseType type) => DefenseType = type;
|
public void SetDefenseType(DefenseType type) => DefenseType = type;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace BlueWaterProject
|
|||||||
#region Property and variable
|
#region Property and variable
|
||||||
|
|
||||||
[PropertyOrder(-11)]
|
[PropertyOrder(-11)]
|
||||||
//[EnableIf("@unit.AttackerType == AttackerType.OFFENSE")]
|
[ShowIf("@unit.AttackerType == AttackerType.OFFENSE")]
|
||||||
//[InlineButton("SetIslandInfoTest", "테스트 설정")]
|
//[InlineButton("SetIslandInfoTest", "테스트 설정")]
|
||||||
[SerializeField] private IslandInfo attackIslandInfo;
|
[SerializeField] private IslandInfo attackIslandInfo;
|
||||||
|
|
||||||
@ -58,6 +58,7 @@ namespace BlueWaterProject
|
|||||||
[PropertyOrder(-9)]
|
[PropertyOrder(-9)]
|
||||||
[HorizontalGroup("Split", 0.5f)]
|
[HorizontalGroup("Split", 0.5f)]
|
||||||
[GUIColor("GetCreateUnitButtonColor")]
|
[GUIColor("GetCreateUnitButtonColor")]
|
||||||
|
[EnableIf("@DataManager.Inst.GetUnitSoKey(unit.Idx) != null")]
|
||||||
[Button("유닛 생성")]
|
[Button("유닛 생성")]
|
||||||
public void CreateUnit()
|
public void CreateUnit()
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,7 @@ namespace BlueWaterProject
|
|||||||
|
|
||||||
[FormerlySerializedAs("soldierPrefabList")]
|
[FormerlySerializedAs("soldierPrefabList")]
|
||||||
[Tooltip("병력들의 프리팹 리스트(순서 중요)")]
|
[Tooltip("병력들의 프리팹 리스트(순서 중요)")]
|
||||||
[SerializeField] private List<GameObject> characterPrefabList = new(SOLDIER_PREFAB_CAPACITY);
|
[SerializeField] private List<GameObject> characterPrefabList = new(CHARACTER_PREFAB_CAPACITY);
|
||||||
|
|
||||||
[field: Tooltip("병력들의 애니메이터 컨트롤러 리스트")]
|
[field: Tooltip("병력들의 애니메이터 컨트롤러 리스트")]
|
||||||
[field: SerializeField] public List<AnimatorController> AIAnimatorControllerList { get; private set; } = new(GlobalValue.AI_ANIMATOR_CAPACITY);
|
[field: SerializeField] public List<AnimatorController> AIAnimatorControllerList { get; private set; } = new(GlobalValue.AI_ANIMATOR_CAPACITY);
|
||||||
@ -64,7 +64,7 @@ namespace BlueWaterProject
|
|||||||
private Transform playerUnits;
|
private Transform playerUnits;
|
||||||
|
|
||||||
private const int MATRICES_CAPACITY = 9;
|
private const int MATRICES_CAPACITY = 9;
|
||||||
private const int SOLDIER_PREFAB_CAPACITY = 10;
|
private const int CHARACTER_PREFAB_CAPACITY = 10;
|
||||||
private const int PLAYER_UNIT_CAPACITY = 50;
|
private const int PLAYER_UNIT_CAPACITY = 50;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -83,7 +83,7 @@ namespace BlueWaterProject
|
|||||||
GroundLayer = LayerMask.GetMask("Ground");
|
GroundLayer = LayerMask.GetMask("Ground");
|
||||||
MaxGroundDistance = 0.5f;
|
MaxGroundDistance = 0.5f;
|
||||||
UnitSpacing = 0.5f;
|
UnitSpacing = 0.5f;
|
||||||
characterPrefabList = new List<GameObject>(SOLDIER_PREFAB_CAPACITY); // TODO : 프리팹 자동 리셋화 필요
|
characterPrefabList = new List<GameObject>(CHARACTER_PREFAB_CAPACITY);
|
||||||
InitUnitMatrices();
|
InitUnitMatrices();
|
||||||
InitCharacterPrefabList();
|
InitCharacterPrefabList();
|
||||||
InitPlayerUnitList();
|
InitPlayerUnitList();
|
||||||
@ -128,7 +128,7 @@ namespace BlueWaterProject
|
|||||||
BaseCharacterPrefab = Utils.LoadPrefabFromFolder("Assets/05.Prefabs/Character", "BaseCharacter");
|
BaseCharacterPrefab = Utils.LoadPrefabFromFolder("Assets/05.Prefabs/Character", "BaseCharacter");
|
||||||
ArrowPrefab = Utils.LoadPrefabFromFolder("Assets/05.Prefabs", "Arrow_01");
|
ArrowPrefab = Utils.LoadPrefabFromFolder("Assets/05.Prefabs", "Arrow_01");
|
||||||
|
|
||||||
characterPrefabList = new List<GameObject>(SOLDIER_PREFAB_CAPACITY)
|
characterPrefabList = new List<GameObject>(CHARACTER_PREFAB_CAPACITY)
|
||||||
{
|
{
|
||||||
Utils.LoadPrefabFromFolder("Assets/05.Prefabs/Character/Enemy", "Archer_E"),
|
Utils.LoadPrefabFromFolder("Assets/05.Prefabs/Character/Enemy", "Archer_E"),
|
||||||
Utils.LoadPrefabFromFolder("Assets/05.Prefabs/Character/Enemy", "SpearKnight_E"),
|
Utils.LoadPrefabFromFolder("Assets/05.Prefabs/Character/Enemy", "SpearKnight_E"),
|
||||||
@ -206,6 +206,9 @@ namespace BlueWaterProject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 동적 생성용 부대 생성 함수
|
||||||
|
/// </summary>
|
||||||
public void CreateUnit(string cardIdx, AttackerType attackerType)
|
public void CreateUnit(string cardIdx, AttackerType attackerType)
|
||||||
{
|
{
|
||||||
var card = DataManager.Inst.GetCardDictionaryKey(cardIdx);
|
var card = DataManager.Inst.GetCardDictionaryKey(cardIdx);
|
||||||
@ -213,15 +216,14 @@ namespace BlueWaterProject
|
|||||||
var captainStat = DataManager.Inst.GetAiStatDictionaryKey(unit.CaptainStatIdx);
|
var captainStat = DataManager.Inst.GetAiStatDictionaryKey(unit.CaptainStatIdx);
|
||||||
var sailorStat = DataManager.Inst.GetAiStatDictionaryKey(unit.SailorStatIdx);
|
var sailorStat = DataManager.Inst.GetAiStatDictionaryKey(unit.SailorStatIdx);
|
||||||
|
|
||||||
// 비활성화 생성 및 정렬
|
|
||||||
SetPlayerUnits();
|
SetPlayerUnits();
|
||||||
|
|
||||||
var newUnitController = Instantiate(UnitPrefab, Vector3.zero, Quaternion.identity, playerUnits).GetComponent<UnitController>();
|
var newUnitController = Instantiate(UnitPrefab, Vector3.zero, Quaternion.identity, playerUnits).GetComponent<UnitController>();
|
||||||
newUnitController.unit = new Unit(unit);
|
newUnitController.unit = new Unit(unit);
|
||||||
|
|
||||||
DestroyDeployedUnits(newUnitController);
|
DestroyDeployedUnits(newUnitController);
|
||||||
|
|
||||||
var baseName = characterPrefabList[(int)newUnitController.unit.UnitType].name;
|
var baseName = newUnitController.unit.UnitType.ToString();
|
||||||
SetUnitName(newUnitController, baseName);
|
SetUnitName(newUnitController, baseName);
|
||||||
|
|
||||||
newUnitController.unit.UnitList = new List<AiController>(newUnitController.unit.SailorCount + 1);
|
newUnitController.unit.UnitList = new List<AiController>(newUnitController.unit.SailorCount + 1);
|
||||||
@ -273,22 +275,92 @@ namespace BlueWaterProject
|
|||||||
baseObj.name = newSoldierName;
|
baseObj.name = newSoldierName;
|
||||||
baseObj.gameObject.SetActive(false);
|
baseObj.gameObject.SetActive(false);
|
||||||
|
|
||||||
AiController aiController;
|
var aiController = GetAiController(baseObj, newUnitController.unit.UnitType, currentPos == heroPosition ? captainStat : sailorStat);
|
||||||
if (currentPos == heroPosition)
|
|
||||||
{
|
|
||||||
aiController = GetAiController(baseObj, newUnitController.unit.UnitType, captainStat);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aiController = GetAiController(baseObj, newUnitController.unit.UnitType, sailorStat);
|
|
||||||
}
|
|
||||||
|
|
||||||
aiController.SetAttackerType(attackerType);
|
aiController.SetAttackerType(attackerType);
|
||||||
newUnitController.unit.UnitList.Add(aiController);
|
newUnitController.unit.UnitList.Add(aiController);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newUnitController.transform.rotation *= unitControllerRotation;
|
newUnitController.transform.rotation *= unitControllerRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 에디터용 부대 생성 함수
|
||||||
|
/// </summary>
|
||||||
|
public void CreateUnit(UnitController unitController)
|
||||||
|
{
|
||||||
|
var unit = DataManager.Inst.GetUnitSoKey(unitController.unit.Idx);
|
||||||
|
|
||||||
|
SetPlayerUnits();
|
||||||
|
|
||||||
|
unitController.unit = new Unit(unit);
|
||||||
|
|
||||||
|
var captainStat = DataManager.Inst.GetAiStatSoKey(unitController.unit.CaptainStatIdx);
|
||||||
|
var sailorStat = DataManager.Inst.GetAiStatSoKey(unitController.unit.SailorStatIdx);
|
||||||
|
|
||||||
|
DestroyDeployedUnits(unitController);
|
||||||
|
|
||||||
|
var baseName = unitController.unit.UnitType.ToString();
|
||||||
|
SetUnitName(unitController, baseName);
|
||||||
|
|
||||||
|
unitController.unit.UnitList = new List<AiController>(unitController.unit.SailorCount + 1);
|
||||||
|
|
||||||
|
var unitControllerTransform = unitController.transform;
|
||||||
|
var unitControllerRotation = unitControllerTransform.rotation;
|
||||||
|
unitControllerTransform.rotation = Quaternion.identity;
|
||||||
|
|
||||||
|
var gridSize = 0;
|
||||||
|
|
||||||
|
switch (unitController.unit.SailorCount)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
gridSize = 1;
|
||||||
|
break;
|
||||||
|
case <= 3:
|
||||||
|
gridSize = 2;
|
||||||
|
break;
|
||||||
|
case <= 8:
|
||||||
|
gridSize = 3;
|
||||||
|
break;
|
||||||
|
case <= 15:
|
||||||
|
gridSize = 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
print("유닛의 병사 숫자 설정 에러");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var heroPosition = (gridSize * gridSize) / 2;
|
||||||
|
|
||||||
|
for (var i = 0; i < gridSize; i++)
|
||||||
|
{
|
||||||
|
for (var j = 0; j < gridSize; j++)
|
||||||
|
{
|
||||||
|
var currentPos = i * gridSize + j;
|
||||||
|
|
||||||
|
if (currentPos > unitController.unit.SailorCount) break;
|
||||||
|
|
||||||
|
var xOffset = (i - (gridSize - 1) / 2.0f) * UnitSpacing;
|
||||||
|
var zOffset = (j - (gridSize - 1) / 2.0f) * UnitSpacing;
|
||||||
|
var spawnPosition = unitControllerTransform.position + new Vector3(xOffset, 0, zOffset);
|
||||||
|
|
||||||
|
var baseObj = Instantiate(BaseCharacterPrefab, spawnPosition,
|
||||||
|
Quaternion.identity, unitController.transform);
|
||||||
|
|
||||||
|
var newSoldierName = $"{baseName}_{currentPos + 1:00}";
|
||||||
|
|
||||||
|
baseObj.name = newSoldierName;
|
||||||
|
baseObj.gameObject.SetActive(false);
|
||||||
|
|
||||||
|
var aiController = GetAiController(baseObj, unitController.unit.UnitType, currentPos == heroPosition ? captainStat : sailorStat);
|
||||||
|
|
||||||
|
aiController.SetAttackerType(unitController.unit.AttackerType);
|
||||||
|
aiController.InitStartInEditor();
|
||||||
|
unitController.unit.UnitList.Add(aiController);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unitController.transform.rotation *= unitControllerRotation;
|
||||||
|
}
|
||||||
|
|
||||||
private AiController GetAiController(GameObject baseObj, GlobalValue.UnitType unitType, AiStat aiStat)
|
private AiController GetAiController(GameObject baseObj, GlobalValue.UnitType unitType, AiStat aiStat)
|
||||||
{
|
{
|
||||||
@ -335,68 +407,6 @@ namespace BlueWaterProject
|
|||||||
|
|
||||||
temp.AiStat = new AiStat(aiStat);
|
temp.AiStat = new AiStat(aiStat);
|
||||||
return temp;
|
return temp;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 부대 생성 함수
|
|
||||||
/// </summary>
|
|
||||||
public void CreateUnit(UnitController unitController)
|
|
||||||
{
|
|
||||||
DestroyDeployedUnits(unitController);
|
|
||||||
|
|
||||||
var baseName = characterPrefabList[(int)unitController.unit.UnitType].name;
|
|
||||||
SetUnitName(unitController, baseName);
|
|
||||||
|
|
||||||
unitController.unit.UnitList = new List<AiController>(unitController.unit.SailorCount);
|
|
||||||
|
|
||||||
var matrix = UnitMatrices.Find(um => um.units == unitController.unit.SailorCount);
|
|
||||||
if (matrix == null)
|
|
||||||
{
|
|
||||||
Debug.LogError("사용할 수 없는 병력의 숫자입니다. UnitManager의 UnitMatrices를 확인해주세요.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var unitControllerTransform = unitController.transform;
|
|
||||||
var unitControllerRotation = unitControllerTransform.rotation;
|
|
||||||
unitControllerTransform.rotation = Quaternion.identity;
|
|
||||||
|
|
||||||
for (var i = 0; i < unitController.unit.SailorCount; i++)
|
|
||||||
{
|
|
||||||
var row = i / matrix.columns;
|
|
||||||
var column = i % matrix.columns;
|
|
||||||
|
|
||||||
var xOffset = (column - (matrix.columns - 1) / 2.0f) * UnitSpacing;
|
|
||||||
var zOffset = (row - (matrix.rows - 1) / 2.0f) * UnitSpacing;
|
|
||||||
var spawnPosition = unitControllerTransform.position + new Vector3(xOffset, 0, zOffset);
|
|
||||||
|
|
||||||
var soldierObject = Instantiate(characterPrefabList[(int)unitController.unit.UnitType], spawnPosition,
|
|
||||||
Quaternion.identity, unitController.transform).GetComponent<AiController>();
|
|
||||||
|
|
||||||
var newSoldierName = $"{baseName}_{i + 1:00}";
|
|
||||||
|
|
||||||
soldierObject.name = newSoldierName;
|
|
||||||
unitController.unit.UnitList.Add(soldierObject);
|
|
||||||
soldierObject.gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
unitController.transform.rotation *= unitControllerRotation;
|
|
||||||
|
|
||||||
// if (unitController.unit.UnitType.ToString().Contains("_E"))
|
|
||||||
// {
|
|
||||||
// unitController.SetAttackerType(AttackerType.DEFENSE);
|
|
||||||
// foreach (var soldier in unitController.unit.UnitList)
|
|
||||||
// {
|
|
||||||
// soldier.SetAttackerType(AttackerType.DEFENSE);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else if (unitController.unit.UnitType.ToString().Contains("_P"))
|
|
||||||
// {
|
|
||||||
// unitController.SetAttackerType(AttackerType.OFFENSE);
|
|
||||||
// foreach (var soldier in unitController.unit.UnitList)
|
|
||||||
// {
|
|
||||||
// soldier.SetAttackerType(AttackerType.DEFENSE);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -19,60 +19,67 @@ MonoBehaviour:
|
|||||||
<UnitName>k__BackingField: Legolas
|
<UnitName>k__BackingField: Legolas
|
||||||
<UnitType>k__BackingField: 5
|
<UnitType>k__BackingField: 5
|
||||||
<SailorCount>k__BackingField: 8
|
<SailorCount>k__BackingField: 8
|
||||||
<AttackerType>k__BackingField: 0
|
<AttackerType>k__BackingField: -1
|
||||||
<OffenseType>k__BackingField: 0
|
<OffenseType>k__BackingField: 0
|
||||||
<DefenseType>k__BackingField: -1
|
<DefenseType>k__BackingField: -1
|
||||||
|
<UnitList>k__BackingField: []
|
||||||
- <Idx>k__BackingField: unit_archer_p_002
|
- <Idx>k__BackingField: unit_archer_p_002
|
||||||
<CaptainStatIdx>k__BackingField: ai_stat_captain_p_001
|
<CaptainStatIdx>k__BackingField: ai_stat_captain_p_001
|
||||||
<SailorStatIdx>k__BackingField: ai_stat_sailor_p_001
|
<SailorStatIdx>k__BackingField: ai_stat_sailor_p_001
|
||||||
<UnitName>k__BackingField: Robin Hood
|
<UnitName>k__BackingField: Robin Hood
|
||||||
<UnitType>k__BackingField: 5
|
<UnitType>k__BackingField: 5
|
||||||
<SailorCount>k__BackingField: 5
|
<SailorCount>k__BackingField: 5
|
||||||
<AttackerType>k__BackingField: 0
|
<AttackerType>k__BackingField: -1
|
||||||
<OffenseType>k__BackingField: 0
|
<OffenseType>k__BackingField: 0
|
||||||
<DefenseType>k__BackingField: -1
|
<DefenseType>k__BackingField: -1
|
||||||
|
<UnitList>k__BackingField: []
|
||||||
- <Idx>k__BackingField: unit_axeman_p_001
|
- <Idx>k__BackingField: unit_axeman_p_001
|
||||||
<CaptainStatIdx>k__BackingField: ai_stat_captain_p_002
|
<CaptainStatIdx>k__BackingField: ai_stat_captain_p_002
|
||||||
<SailorStatIdx>k__BackingField: ai_stat_sailor_p_002
|
<SailorStatIdx>k__BackingField: ai_stat_sailor_p_002
|
||||||
<UnitName>k__BackingField: Olaf
|
<UnitName>k__BackingField: Olaf
|
||||||
<UnitType>k__BackingField: 6
|
<UnitType>k__BackingField: 6
|
||||||
<SailorCount>k__BackingField: 5
|
<SailorCount>k__BackingField: 5
|
||||||
<AttackerType>k__BackingField: 0
|
<AttackerType>k__BackingField: -1
|
||||||
<OffenseType>k__BackingField: 0
|
<OffenseType>k__BackingField: 0
|
||||||
<DefenseType>k__BackingField: -1
|
<DefenseType>k__BackingField: -1
|
||||||
|
<UnitList>k__BackingField: []
|
||||||
- <Idx>k__BackingField: unit_spearman_p_001
|
- <Idx>k__BackingField: unit_spearman_p_001
|
||||||
<CaptainStatIdx>k__BackingField: ai_stat_captain_p_003
|
<CaptainStatIdx>k__BackingField: ai_stat_captain_p_003
|
||||||
<SailorStatIdx>k__BackingField: ai_stat_sailor_p_003
|
<SailorStatIdx>k__BackingField: ai_stat_sailor_p_003
|
||||||
<UnitName>k__BackingField: Lancer
|
<UnitName>k__BackingField: Lancer
|
||||||
<UnitType>k__BackingField: 7
|
<UnitType>k__BackingField: 7
|
||||||
<SailorCount>k__BackingField: 7
|
<SailorCount>k__BackingField: 7
|
||||||
<AttackerType>k__BackingField: 0
|
<AttackerType>k__BackingField: -1
|
||||||
<OffenseType>k__BackingField: 1
|
<OffenseType>k__BackingField: 1
|
||||||
<DefenseType>k__BackingField: -1
|
<DefenseType>k__BackingField: -1
|
||||||
|
<UnitList>k__BackingField: []
|
||||||
- <Idx>k__BackingField: unit_sword_knight_p_001
|
- <Idx>k__BackingField: unit_sword_knight_p_001
|
||||||
<CaptainStatIdx>k__BackingField: ai_stat_captain_p_004
|
<CaptainStatIdx>k__BackingField: ai_stat_captain_p_004
|
||||||
<SailorStatIdx>k__BackingField: ai_stat_sailor_p_004
|
<SailorStatIdx>k__BackingField: ai_stat_sailor_p_004
|
||||||
<UnitName>k__BackingField: Achilles
|
<UnitName>k__BackingField: Achilles
|
||||||
<UnitType>k__BackingField: 8
|
<UnitType>k__BackingField: 8
|
||||||
<SailorCount>k__BackingField: 3
|
<SailorCount>k__BackingField: 3
|
||||||
<AttackerType>k__BackingField: 0
|
<AttackerType>k__BackingField: -1
|
||||||
<OffenseType>k__BackingField: 0
|
<OffenseType>k__BackingField: 0
|
||||||
<DefenseType>k__BackingField: -1
|
<DefenseType>k__BackingField: -1
|
||||||
|
<UnitList>k__BackingField: []
|
||||||
- <Idx>k__BackingField: unit_swordman_p_001
|
- <Idx>k__BackingField: unit_swordman_p_001
|
||||||
<CaptainStatIdx>k__BackingField: ai_stat_captain_p_005
|
<CaptainStatIdx>k__BackingField: ai_stat_captain_p_005
|
||||||
<SailorStatIdx>k__BackingField: ai_stat_sailor_p_005
|
<SailorStatIdx>k__BackingField: ai_stat_sailor_p_005
|
||||||
<UnitName>k__BackingField: Aragorn
|
<UnitName>k__BackingField: Aragorn
|
||||||
<UnitType>k__BackingField: 9
|
<UnitType>k__BackingField: 9
|
||||||
<SailorCount>k__BackingField: 5
|
<SailorCount>k__BackingField: 5
|
||||||
<AttackerType>k__BackingField: 0
|
<AttackerType>k__BackingField: -1
|
||||||
<OffenseType>k__BackingField: 1
|
<OffenseType>k__BackingField: 1
|
||||||
<DefenseType>k__BackingField: -1
|
<DefenseType>k__BackingField: -1
|
||||||
|
<UnitList>k__BackingField: []
|
||||||
- <Idx>k__BackingField: unit_swordman_p_002
|
- <Idx>k__BackingField: unit_swordman_p_002
|
||||||
<CaptainStatIdx>k__BackingField: ai_stat_captain_p_005
|
<CaptainStatIdx>k__BackingField: ai_stat_captain_p_005
|
||||||
<SailorStatIdx>k__BackingField: ai_stat_sailor_p_005
|
<SailorStatIdx>k__BackingField: ai_stat_sailor_p_005
|
||||||
<UnitName>k__BackingField: King Arthur
|
<UnitName>k__BackingField: King Arthur
|
||||||
<UnitType>k__BackingField: 9
|
<UnitType>k__BackingField: 9
|
||||||
<SailorCount>k__BackingField: 11
|
<SailorCount>k__BackingField: 11
|
||||||
<AttackerType>k__BackingField: 0
|
<AttackerType>k__BackingField: -1
|
||||||
<OffenseType>k__BackingField: 0
|
<OffenseType>k__BackingField: 0
|
||||||
<DefenseType>k__BackingField: -1
|
<DefenseType>k__BackingField: -1
|
||||||
|
<UnitList>k__BackingField: []
|
||||||
|
@ -6,7 +6,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class DataManager : Singleton<DataManager>
|
public class DataManager : Singleton<DataManager>
|
||||||
{
|
{
|
||||||
[Title("Scriptable Object")]
|
[field: Title("Scriptable Object")]
|
||||||
[field: SerializeField] public AiViewDataSo AiViewDataSo { get; private set; }
|
[field: SerializeField] public AiViewDataSo AiViewDataSo { get; private set; }
|
||||||
private Dictionary<string, AiView> aiViewDictionary;
|
private Dictionary<string, AiView> aiViewDictionary;
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ public class DataManager : Singleton<DataManager>
|
|||||||
[field: SerializeField] public CardDataSo CardDataSo { get; private set; }
|
[field: SerializeField] public CardDataSo CardDataSo { get; private set; }
|
||||||
private Dictionary<string, Card> cardDictionary;
|
private Dictionary<string, Card> cardDictionary;
|
||||||
|
|
||||||
[Title("DataBase")]
|
[field: Title("DataBase")]
|
||||||
[field: SerializeField] public List<string> CardList { get; private set; } = new(GlobalValue.CARD_DATA_CAPACITY);
|
[field: SerializeField] public List<string> CardList { get; private set; } = new(GlobalValue.CARD_DATA_CAPACITY);
|
||||||
|
|
||||||
[Title("DataBase", "GameObject")]
|
[Title("DataBase", "GameObject")]
|
||||||
@ -72,4 +72,10 @@ public class DataManager : Singleton<DataManager>
|
|||||||
public AiStat GetAiStatDictionaryKey(string idx) => aiStatDictionary[idx] != null ? aiStatDictionary[idx] : null;
|
public AiStat GetAiStatDictionaryKey(string idx) => aiStatDictionary[idx] != null ? aiStatDictionary[idx] : null;
|
||||||
public Unit GetUnitDictionaryKey(string idx) => unitDictionary[idx] != null ? unitDictionary[idx] : null;
|
public Unit GetUnitDictionaryKey(string idx) => unitDictionary[idx] != null ? unitDictionary[idx] : null;
|
||||||
public Card GetCardDictionaryKey(string idx) => cardDictionary[idx] != null ? cardDictionary[idx] : null;
|
public Card GetCardDictionaryKey(string idx) => cardDictionary[idx] != null ? cardDictionary[idx] : null;
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
public AiView GetAiViewSoKey(string idx) => AiViewDataSo.aiViewDataList.Find(item => item.Idx == idx);
|
||||||
|
public AiStat GetAiStatSoKey(string idx) => AiStatDataSo.aiStatDataList.Find(item => item.Idx == idx);
|
||||||
|
public Unit GetUnitSoKey(string idx) => UnitDataSo.unitDataList.Find(item => item.Idx == idx);
|
||||||
|
#endif
|
||||||
}
|
}
|
@ -44,8 +44,15 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 8ed17fd326510c349a4daf1dac3d88cc, type: 3}
|
m_Script: {fileID: 11500000, guid: 8ed17fd326510c349a4daf1dac3d88cc, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
attackIslandInfo: {fileID: 0}
|
||||||
unit:
|
unit:
|
||||||
unitName:
|
<Idx>k__BackingField:
|
||||||
unitType: 10
|
<CaptainStatIdx>k__BackingField:
|
||||||
soliderCount: 0
|
<SailorStatIdx>k__BackingField:
|
||||||
soldierList: []
|
<UnitName>k__BackingField:
|
||||||
|
<UnitType>k__BackingField: -1
|
||||||
|
<SailorCount>k__BackingField: 0
|
||||||
|
<AttackerType>k__BackingField: -1
|
||||||
|
<OffenseType>k__BackingField: -1
|
||||||
|
<DefenseType>k__BackingField: -1
|
||||||
|
<UnitList>k__BackingField: []
|
||||||
|
Loading…
Reference in New Issue
Block a user