You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
791 B
37 lines
791 B
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);
|
|
}
|
|
}
|