Files
Cielonos/Assets/Scripts/MainGame/Items/Data/FunctionData.cs

88 lines
2.7 KiB
C#
Raw Normal View History

2025-11-25 08:19:33 -05:00
using System;
using System.Collections.Generic;
2026-05-27 15:15:28 -04:00
using System.Collections.Specialized;
2025-11-25 08:19:33 -05:00
using Cielonos.MainGame.Characters;
using Sirenix.OdinInspector;
2026-02-13 09:22:11 -05:00
using SLSUtilities.General;
2026-05-27 15:15:28 -04:00
using SoftCircuits.Collections;
2025-11-25 08:19:33 -05:00
using UnityEngine;
2026-05-27 15:15:28 -04:00
using UnityEngine.Serialization;
2025-11-25 08:19:33 -05:00
2026-05-23 08:27:50 -04:00
namespace Cielonos.MainGame.Inventory
2025-11-25 08:19:33 -05:00
{
[CreateAssetMenu(fileName = "FunctionData", menuName = "Cielonos/Items/FunctionData")]
2025-12-23 19:47:06 -05:00
public partial class FunctionData : SerializedScriptableObject
2025-11-25 08:19:33 -05:00
{
2026-05-27 15:15:28 -04:00
[ListDrawerSettings(ShowIndexLabels = false, ListElementLabelName = "unitName", CustomAddFunction = "AddFunctionUnit")]
2025-11-25 08:19:33 -05:00
[Searchable]
2026-05-27 15:15:28 -04:00
public List<FunctionUnit> functionUnitList = new List<FunctionUnit>();
2025-11-25 08:19:33 -05:00
[OnInspectorGUI("UpdateUnits")]
public void UpdateUnits()
{
2026-05-27 15:15:28 -04:00
foreach (var unit in functionUnitList)
2025-11-25 08:19:33 -05:00
{
unit.parentData = this;
}
}
2026-05-27 15:15:28 -04:00
private FunctionUnit AddFunctionUnit()
{
FunctionUnit newUnit = new FunctionUnit
{
unitName = $"Function {functionUnitList.Count + 1}",
parentData = this
};
return newUnit;
}
2025-11-25 08:19:33 -05:00
}
2025-12-23 19:47:06 -05:00
public partial class FunctionData
2025-11-25 08:19:33 -05:00
{
2026-05-27 15:15:28 -04:00
public enum CooldownReductionType
2025-11-25 08:19:33 -05:00
{
None = 0,
Cooldown = 1,
AttackSpeed = 10
}
2025-12-23 19:47:06 -05:00
public class FunctionUnit
{
[ReadOnly]
public FunctionData parentData;
2026-05-27 15:15:28 -04:00
[TitleGroup("Information")]
public string unitName;
2025-12-23 19:47:06 -05:00
[TitleGroup("Information")]
public bool shownInUI;
[TitleGroup("Information")]
2026-05-27 15:15:28 -04:00
[HideIf("shownInUI")]
public bool isMain;
[TitleGroup("Information")]
[ShowIf("@shownInUI || isMain")]
2025-12-23 19:47:06 -05:00
public Sprite icon;
[TitleGroup("Information")]
2026-05-27 15:15:28 -04:00
public List<string> operation = new List<string>();
[TitleGroup("Information")]
[ValueDropdown("Tags")]
public List<string> tags = new List<string>();
2025-11-25 08:19:33 -05:00
2025-12-23 19:47:06 -05:00
[TitleGroup("Costs")]
public float energyCost;
[TitleGroup("Costs")]
public int ammoCost;
2025-11-25 08:19:33 -05:00
2026-05-27 15:15:28 -04:00
[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"
};
2025-12-23 19:47:06 -05:00
}
2025-11-25 08:19:33 -05:00
}
}