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.
58 lines
896 B
58 lines
896 B
using UnityEngine; |
|
using System; |
|
using System.Collections; |
|
|
|
namespace Fungus |
|
{ |
|
|
|
public class BooleanVariable : Variable |
|
{ |
|
public bool value; |
|
|
|
protected bool startValue; |
|
|
|
public override void OnReset() |
|
{ |
|
value = startValue; |
|
} |
|
|
|
public override string ToString() |
|
{ |
|
return value.ToString(); |
|
} |
|
|
|
protected virtual void Start() |
|
{ |
|
startValue = value; |
|
} |
|
} |
|
|
|
[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; |
|
} |
|
} |
|
} |
|
|
|
} |