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.
57 lines
858 B
57 lines
858 B
using UnityEngine; |
|
using System.Collections; |
|
|
|
namespace Fungus |
|
{ |
|
|
|
public class FloatVariable : Variable |
|
{ |
|
public float value; |
|
|
|
protected float startValue; |
|
|
|
public override void OnReset() |
|
{ |
|
value = startValue; |
|
} |
|
|
|
public override string ToString() |
|
{ |
|
return value.ToString(); |
|
} |
|
|
|
protected virtual void Start() |
|
{ |
|
startValue = value; |
|
} |
|
} |
|
|
|
[System.Serializable] |
|
public struct FloatData |
|
{ |
|
[SerializeField] |
|
public FloatVariable floatRef; |
|
|
|
[SerializeField] |
|
public float floatVal; |
|
|
|
public float Value |
|
{ |
|
get { return (floatRef == null) ? floatVal : floatRef.value; } |
|
set { if (floatRef == null) { floatVal = value; } else { floatRef.value = value; } } |
|
} |
|
|
|
public string GetDescription() |
|
{ |
|
if (floatRef == null) |
|
{ |
|
return floatVal.ToString(); |
|
} |
|
else |
|
{ |
|
return floatRef.key; |
|
} |
|
} |
|
} |
|
|
|
} |