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.
53 lines
901 B
53 lines
901 B
using UnityEngine; |
|
using System; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
|
|
namespace Fungus |
|
{ |
|
|
|
public class IfBooleanCommand : FungusCommand |
|
{ |
|
public string key; |
|
|
|
public Sequence trueSequence; |
|
public Sequence falseSequence; |
|
|
|
public override void OnEnter() |
|
{ |
|
if (Variables.GetBoolean(key)) |
|
{ |
|
ExecuteSequence(trueSequence); |
|
} |
|
else |
|
{ |
|
ExecuteSequence(falseSequence); |
|
} |
|
} |
|
|
|
public void OnDrawGizmos() |
|
{ |
|
if (trueSequence == null || falseSequence == null) |
|
{ |
|
errorMessage = "Please select true and false Sequence objects"; |
|
} |
|
else |
|
{ |
|
errorMessage = ""; |
|
} |
|
} |
|
|
|
public override void GetConnectedSequences(ref List<Sequence> connectedSequences) |
|
{ |
|
if (trueSequence != null) |
|
{ |
|
connectedSequences.Add(trueSequence); |
|
} |
|
if (falseSequence != null) |
|
{ |
|
connectedSequences.Add(falseSequence); |
|
} |
|
} |
|
} |
|
|
|
} |