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
1.0 KiB

using UnityEngine;
using System;
using System.Collections;
namespace Fungus
{
public class BooleanVariable : Variable
{
protected bool booleanVal;
public bool Value
{
get { return (scope == VariableScope.Local) ? booleanVal : GlobalVariables.GetBoolean(key); }
set { if (scope == VariableScope.Local) { booleanVal = value; } else { GlobalVariables.SetBoolean(key, value); } }
}
public override void OnReset()
{
Value = false;
}
public override string ToString()
{
return Value.ToString();
}
}
[System.Serializable]
public struct BooleanData
{
[SerializeField]
public BooleanVariable booleanRef;
[SerializeField]
public bool booleanVal;
public bool Value
{
get { return (booleanRef == null) ? booleanVal : booleanRef.Value; }
set { if (booleanRef == null) { booleanVal = value; } else { booleanRef.Value = value; } }
}
public string GetDescription()
{
if (booleanRef == null)
{
return booleanVal.ToString();
}
else
{
return booleanRef.key;
}
}
}
}