123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- 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<string>()
- {
- { "+", "+" },
- { "-", "-" }
- };
- private IEnumerable GetEndOperators = new ValueDropdownList<string>()
- {
- { " ", "" },
- { "%", "%" }
- };
- private IEnumerable GetValueTypes = new ValueDropdownList<string>()
- {
- { " ", "" },
- { "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;
- }
- }
- }
|