init
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Sirenix.OdinInspector;
|
||||
using VOID.Generic.Objects.Wearable;
|
||||
|
||||
namespace VOID.Generic.Objects.Armor
|
||||
{
|
||||
public class ArmorObject : WearableObject
|
||||
{
|
||||
[Title("=== ArmorObject properties ===")]
|
||||
public ArmorObjectData armorData;
|
||||
public ArmorObjectState armorState;
|
||||
|
||||
protected override List<ObjectComponent> GetObjectComponents()
|
||||
{
|
||||
return base.GetObjectComponents()
|
||||
.Union(new List<ObjectComponent>
|
||||
{
|
||||
armorData,
|
||||
armorState
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6eb1f4806e1248218f6a2b3c5e42a055
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 40d4d94b5847b2f4f9b1d23eba7f2dbe, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using Sirenix.OdinInspector;
|
||||
using VOID.Generic.Dict;
|
||||
|
||||
namespace VOID.Generic.Objects.Armor
|
||||
{
|
||||
[Serializable]
|
||||
public class ArmorObjectData : ObjectComponent<ArmorObject>
|
||||
{
|
||||
[Title("Basic")]
|
||||
[Required] public ArmorType armorType;
|
||||
[Required] public ArmorSubType armorSubType;
|
||||
|
||||
[Title("Visual")]
|
||||
public bool hideTopUnderwear;
|
||||
public bool hideBottomUnderwear;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dae07605591c43cfb0479b77921728f2
|
||||
timeCreated: 1705009430
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using VOID.Generic.Dict;
|
||||
using VOID.Generic.Objects.Wearable.Events;
|
||||
|
||||
namespace VOID.Generic.Objects.Armor
|
||||
{
|
||||
[Serializable]
|
||||
public class ArmorObjectState : ObjectComponent<ArmorObject>
|
||||
{
|
||||
#region Initialize
|
||||
|
||||
protected override void EventInitialize()
|
||||
{
|
||||
parent.wearableEvents.onEquippedAfter.AddListener(OnEquip);
|
||||
parent.wearableEvents.onUnEquippedAfter.AddListener(OnUnEquip);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void OnEquip(EquipEvent equipEvent)
|
||||
{
|
||||
// Hide top and bottom underwear if needed
|
||||
if (parent.armorData.hideBottomUnderwear && equipEvent.unit.unitData.bottomUnderwear)
|
||||
equipEvent.unit.unitData.bottomUnderwear.SetActive(false);
|
||||
if (parent.armorData.hideTopUnderwear && equipEvent.unit.unitData.topUnderwear)
|
||||
equipEvent.unit.unitData.topUnderwear.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnUnEquip(UnEquipEvent unEquipEvent)
|
||||
{
|
||||
// Show top and bottom underwear if needed
|
||||
if (parent.armorData.hideBottomUnderwear && unEquipEvent.unit.unitData.bottomUnderwear)
|
||||
unEquipEvent.unit.unitData.bottomUnderwear.SetActive(true);
|
||||
if (parent.armorData.hideTopUnderwear && unEquipEvent.unit.unitData.topUnderwear)
|
||||
unEquipEvent.unit.unitData.topUnderwear.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7908638d19484a3d9134ff20ba78a8e8
|
||||
timeCreated: 1733943128
|
||||
Reference in New Issue
Block a user