1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using System;
- using System.Collections;
- using System.Linq;
- using System.Collections.Generic;
- using UnityEngine;
- using Sirenix.OdinInspector;
- namespace KairoEngine.Stats
- {
- public enum StatValueType
- {
- Value,
- Equation
- }
- [HideMonoScript]
- [CreateAssetMenu(fileName = "Stat", menuName = "KairoEngine/Stat", order = 6)]
- public class StatTemplate : ScriptableObject
- {
- public string title = "Stat Name";
- public string description = "";
- [Header("Current Value")]
- [LabelText("Type")] public StatValueType currentValueType = StatValueType.Value;
- [LabelText("Equation"), ShowIf("@currentValueType == StatValueType.Equation")] public string currentValueEquation;
- [Header("Initial Value")]
- [LabelText("Type"), HideIf("@currentValueType == StatValueType.Equation")] public StatValueType initialValueType = StatValueType.Value;
- [LabelText("Value"), ShowIf("@initialValueType == StatValueType.Value && currentValueType != StatValueType.Equation")] public int initialValue = 100;
- [LabelText("Equation"), ShowIf("@initialValueType == StatValueType.Equation && currentValueType != StatValueType.Equation")] public string initialValueEquation;
-
- [Header("Minimum Value")]
- [LabelText("Type")] public StatValueType minValueType = StatValueType.Value;
- [LabelText("Value"), ShowIf("@minValueType == StatValueType.Value")] public int minValue = 0;
- [LabelText("Equation"), ShowIf("@minValueType == StatValueType.Equation")] public string minValueEquation;
- [Header("Maximum Value")]
- [LabelText("Type")] public StatValueType maxValueType = StatValueType.Value;
- [LabelText("Value"), ShowIf("@maxValueType == StatValueType.Value")] public int maxValue = 100;
- [LabelText("Equation"), ShowIf("@maxValueType == StatValueType.Equation")] public string maxValueEquation;
- public StatTemplate Setup(string title, string desc, int init, int min, int max, string valueEq="", string initEq="", string minEq="", string maxEq="")
- {
- this.title = title;
- this.description = desc;
- initialValue = init;
- minValue = min;
- maxValue = max;
- currentValueType = StatValueType.Value;
- initialValueType = StatValueType.Value;
- minValueType = StatValueType.Value;
- maxValueType = StatValueType.Value;
- if(valueEq != "")
- {
- currentValueEquation = valueEq;
- currentValueType = StatValueType.Equation;
- }
- else if(initEq != "")
- {
- initialValueEquation = initEq;
- initialValueType = StatValueType.Equation;
- }
- if(minEq != "")
- {
- minValueEquation = minEq;
- minValueType = StatValueType.Equation;
- }
- if(maxEq != "")
- {
- maxValueEquation = maxEq;
- maxValueType = StatValueType.Equation;
- }
- return this;
- }
- }
- }
|