using System.Collections; using System.Collections.Generic; using UnityEngine; using Sirenix.OdinInspector; namespace KairoEngine.Stats { [System.Serializable] public class StatModifier { [ShowInInspector, HideLabel, ShowIf("@enabled == true")] public string text => $"{op}{value}{endOp} {valueType} {statName} - {from}"; [ShowInInspector, HideLabel, HorizontalGroup("m",Width=0.02f), ShowIf("@enabled == false")] public bool enabled = false; [HideLabel, HorizontalGroup("m", Width=0.1f), ValueDropdown("GetOperators"), ShowIf("@enabled == false")] public string op = "+"; [HideLabel, HorizontalGroup("m", Width=0.1f), ShowIf("@enabled == false")] public int value = 1; [HideLabel, HorizontalGroup("m", Width=0.1f), ValueDropdown("GetEndOperators"), ShowIf("@enabled == false")] public string endOp = ""; [HideLabel, HorizontalGroup("m", Width=0.16f), ValueDropdown("GetValueTypes"), ShowIf("@enabled == false")] public string valueType = ""; [HideLabel, HorizontalGroup("m", Width=0.2f), ShowIf("@enabled == false")] public string statName = "Stat Name"; [HideLabel, HorizontalGroup("m", Width=0.32f), ShowIf("@enabled == false")] public string from = "From Entity"; private IEnumerable GetOperators = new ValueDropdownList() { { "+", "+" }, { "-", "-" } }; private IEnumerable GetEndOperators = new ValueDropdownList() { { " ", "" }, { "%", "%" } }; private IEnumerable GetValueTypes = new ValueDropdownList() { { " ", "" }, { "min", "min" }, { "max", "max" } }; public bool Equals(StatModifier statModifier) => statModifier.text == text ? true : false; public StatModifier() { this.op = "+"; this.value = 1; this.endOp = ""; this.valueType = ""; this.statName = "Stat Name"; this.from = "From Entity"; this.enabled = false; } public StatModifier(string op = "+", int value = 1, string endOp = "", string valueType = "", string statName = "Stat Name", string from = "From Entity", bool enabled = true) { this.op = op; this.value = value; this.endOp = endOp; this.valueType = valueType; this.statName = statName; this.from = from; this.enabled = enabled; } } }