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.
52 lines
975 B
52 lines
975 B
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; |
|
} |
|
} |
|
|
|
[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; |
|
} |
|
} |
|
} |
|
|
|
} |