An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
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
878 B

using UnityEngine;
using System.Collections;
namespace Fungus
{
public class IntegerVariable : Variable
{
public int value;
protected int startValue;
public override void OnReset()
{
value = startValue;
}
public override string ToString()
{
return value.ToString();
}
protected virtual void Start()
{
startValue = value;
}
}
[System.Serializable]
public struct IntegerData
{
[SerializeField]
public IntegerVariable integerRef;
[SerializeField]
public int integerVal;
public int Value
{
get { return (integerRef == null) ? integerVal : integerRef.value; }
set { if (integerRef == null) { integerVal = value; } else { integerRef.value = value; } }
}
public string GetDescription()
{
if (integerRef == null)
{
return integerVal.ToString();
}
else
{
return integerRef.key;
}
}
}
}