using System; using UnityEngine; [Serializable] public class ValueModifier { public enum OperationType : byte { Flat, Percent, } [SerializeField] OperationType opType; [SerializeField] float value; public OperationType OpType => opType; public float Value => value; public ValueModifier(OperationType opType, float value) { this.opType = opType; this.value = value; } public override string ToString() { string format; switch (OpType) { case OperationType.Flat: format = "+{0}"; break; case OperationType.Percent: format = "{0}%"; break; default: format = "{0}"; break; } return FormatString.StringFormat(format, Value); } }