88 lines
2.7 KiB
C#
88 lines
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Specialized;
|
|
using Cielonos.MainGame.Characters;
|
|
using Sirenix.OdinInspector;
|
|
using SLSUtilities.General;
|
|
using SoftCircuits.Collections;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace Cielonos.MainGame.Inventory
|
|
{
|
|
[CreateAssetMenu(fileName = "FunctionData", menuName = "Cielonos/Items/FunctionData")]
|
|
public partial class FunctionData : SerializedScriptableObject
|
|
{
|
|
[ListDrawerSettings(ShowIndexLabels = false, ListElementLabelName = "unitName", CustomAddFunction = "AddFunctionUnit")]
|
|
[Searchable]
|
|
public List<FunctionUnit> functionUnitList = new List<FunctionUnit>();
|
|
|
|
[OnInspectorGUI("UpdateUnits")]
|
|
public void UpdateUnits()
|
|
{
|
|
foreach (var unit in functionUnitList)
|
|
{
|
|
unit.parentData = this;
|
|
}
|
|
}
|
|
|
|
private FunctionUnit AddFunctionUnit()
|
|
{
|
|
FunctionUnit newUnit = new FunctionUnit
|
|
{
|
|
unitName = $"Function {functionUnitList.Count + 1}",
|
|
parentData = this
|
|
};
|
|
return newUnit;
|
|
}
|
|
}
|
|
|
|
public partial class FunctionData
|
|
{
|
|
public enum CooldownReductionType
|
|
{
|
|
None = 0,
|
|
Cooldown = 1,
|
|
AttackSpeed = 10
|
|
}
|
|
|
|
public class FunctionUnit
|
|
{
|
|
[ReadOnly]
|
|
public FunctionData parentData;
|
|
|
|
[TitleGroup("Information")]
|
|
public string unitName;
|
|
[TitleGroup("Information")]
|
|
public bool shownInUI;
|
|
[TitleGroup("Information")]
|
|
[HideIf("shownInUI")]
|
|
public bool isMain;
|
|
[TitleGroup("Information")]
|
|
[ShowIf("@shownInUI || isMain")]
|
|
public Sprite icon;
|
|
[TitleGroup("Information")]
|
|
public List<string> operation = new List<string>();
|
|
[TitleGroup("Information")]
|
|
[ValueDropdown("Tags")]
|
|
public List<string> tags = new List<string>();
|
|
|
|
[TitleGroup("Costs")]
|
|
public float energyCost;
|
|
[TitleGroup("Costs")]
|
|
public int ammoCost;
|
|
|
|
[FormerlySerializedAs("interval")] [TitleGroup("Cooldown")]
|
|
public float cooldown;
|
|
[FormerlySerializedAs("intervalLowerLimit")] [TitleGroup("Cooldown")]
|
|
public float cooldownLowerLimit;
|
|
[FormerlySerializedAs("intervalReductionType")] [TitleGroup("Cooldown")]
|
|
public CooldownReductionType cooldownReductionType;
|
|
|
|
public static List<string> Tags = new()
|
|
{
|
|
"Disruption"
|
|
};
|
|
}
|
|
}
|
|
} |