A very simple addition to BoolAllTrue :https://hutonggames.fogbugz.com/default.asp?W469
so that I can dispatch a event when the test fails, not just when the test passes. Avoids storing and checking, builds cleaner fsm. Also, I build a lot if states acting as "IF" statements with a "YES" and "NO" set of transitions ( or "TRUE" and "FALSE", whatever ). So this addition allows me to keep consistency in my fsms.
This can be easily applied to similar actions.
Here is the code ( also attached as a file as well for convenience).
Comments and feedback welcomed as always.
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.
[Tooltip("Tests if all the given Bool Variables are True. Ability to send event if test fails")]
public class BoolAllTrueTest : FsmStateAction
public FsmBool boolVariables;
public FsmEvent sendPassEvent;
public FsmEvent sendFailEvent;
public FsmBool storeResult;
public bool everyFrame;
public override void Reset()
boolVariables = null;
sendPassEvent = null;
sendFailEvent = null;
storeResult = null;
everyFrame = false;
public override void OnEnter()
public override void OnUpdate()
if (boolVariables.Length == 0) return;
bool allTrue = true;
for (int i = 0; i < boolVariables.Length; i++)
allTrue = false;
storeResult.Value = allTrue;