void DoFsmStateTest()
        {
            GameObject go = gameObject.Value;
            if (go == null) return;

            if (go != previousGo)
            {
                fsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
                previousGo = go;
            }

            if (fsm == null) return;

            bool isState = false;

            if (fsm.ActiveStateName == stateName.Value)
            {
                Fsm.Event(trueEvent);
                isState = true;
            }
            else
            {
                Fsm.Event(falseEvent);
            }

            storeResult.Value = isState;
        }
        void DoSetFsmBool()
        {
            if (setValue == null)
            {
                return;
            }

            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            if (go != goLastFrame)
            {
                goLastFrame = go;

                // only get the fsm component if go has changed

                fsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
            }

            if (fsm == null)
            {
                return;
            }

            var fsmVar = fsm.FsmVariables.GetFsmObject(variableName.Value);

            if (fsmVar != null)
            {
                fsmVar.Value = setValue.Value;
            }
        }
        void DoGetFsmVariable()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);
            if (go == null)
            {
                return;
            }

            // only get the fsm component if go has changed

            if (go != goLastFrame)
            {
                goLastFrame = go;
                fsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
            }

            if (fsm == null || storeValue == null)
            {
                return;
            }

            var fsmVar = fsm.FsmVariables.GetFsmMaterial(variableName.Value);

            if (fsmVar != null)
            {
                storeValue.Value = fsmVar.Value;
            }
        }
Example #4
0
        void DoFsmStateSwitch()
        {
            GameObject go = gameObject.Value;

            if (go == null)
            {
                return;
            }

            if (go != previousGo)
            {
                fsm        = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
                previousGo = go;
            }

            if (fsm == null)
            {
                return;
            }

            string activeStateName = fsm.ActiveStateName;

            for (int i = 0; i < compareTo.Length; i++)
            {
                if (activeStateName == compareTo[i].Value)
                {
                    Fsm.Event(sendEvent[i]);
                    return;
                }
            }
        }
        void DoGetFsmState()
        {
            if (fsm == null)
            {
                if (fsmComponent != null)
                {
                    fsm = fsmComponent;
                }
                else
                {
                    var go = Fsm.GetOwnerDefaultTarget(gameObject);
                    if (go != null)
                    {
                        fsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
                    }
                }

                if (fsm == null)
                {
                    storeResult.Value = "";
                    return;
                }
            }

            storeResult.Value = fsm.ActiveStateName;
        }
Example #6
0
        void DoGetFsmVariable()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            // only get the fsm component if go has changed

            if (go != goLastFrame)
            {
                goLastFrame = go;
                fsm         = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
            }

            if (fsm == null || storeValue == null)
            {
                return;
            }

            var fsmVar = fsm.FsmVariables.GetFsmTexture(variableName.Value);

            if (fsmVar != null)
            {
                storeValue.Value = fsmVar.Value;
            }
        }
        void DoSetFsmBool()
        {
            if (setValue == null)
            {
                return;
            }

            var go = Fsm.GetOwnerDefaultTarget(gameObject);
            if (go == null)
            {
                return;
            }

            if (go != goLastFrame)
            {
                goLastFrame = go;

                // only get the fsm component if go has changed

                fsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
            }

            if (fsm == null)
            {
                return;
            }

            var fsmVar = fsm.FsmVariables.GetFsmRect(variableName.Value);

            if (fsmVar != null)
            {
                fsmVar.Value = setValue.Value;
            }
        }
        void DoGetFsmState()
        {
            if (fsm == null)
            {
                if (fsmComponent != null)
                {
                    fsm = fsmComponent;
                }
                else
                {
                    var go = Fsm.GetOwnerDefaultTarget(gameObject);
                    if (go != null)
                    {
                        fsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
                    }
                }

                if (fsm == null)
                {
                    storeResult.Value = "";
                    return;
                }
            }

            storeResult.Value = fsm.ActiveStateName;
        }
        void DoFsmStateTest()
        {
            GameObject go = gameObject.Value;

            if (go == null)
            {
                return;
            }

            if (go != previousGo)
            {
                fsm        = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
                previousGo = go;
            }

            if (fsm == null)
            {
                return;
            }

            bool isState = false;

            if (fsm.ActiveStateName == stateName.Value)
            {
                Fsm.Event(trueEvent);
                isState = true;
            }
            else
            {
                Fsm.Event(falseEvent);
            }

            storeResult.Value = isState;
        }
 public override void Reset()
 {
     fsmComponent = null;
     gameObject = null;
     fsmName = "";
     storeResult = null;
     everyFrame = false;
 }
 public override void Reset()
 {
     fsmComponent = null;
     gameObject   = null;
     fsmName      = "";
     storeResult  = null;
     everyFrame   = false;
 }
Example #12
0
 public override void Reset()
 {
     sendToFsmComponent = null;
     sendToGameObject   = null;
     fsmName            = "";
     sendToChildren     = false;
     broadcastToAll     = false;
 }
 public override void Reset()
 {
     sendToFsmComponent = null;
     sendToGameObject = null;
     fsmName = "";
     sendToChildren = false;
     broadcastToAll = false;
 }
        void DoEnableFSM()
        {
            GameObject go = gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value;

            if (go == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(fsmName.Value))
            {
                // find by FSM component name

                var fsmComponents = go.GetComponents <managerFSM>();
                foreach (var component in fsmComponents)
                {
                    if (component.FsmName == fsmName.Value)
                    {
                        fsmComponent = component;
                        break;
                    }
                }
            }
            else
            {
                // get first FSM component

                fsmComponent = go.GetComponent <managerFSM>();
            }

            if (fsmComponent == null)
            {
                // TODO: Not sure if this is an error condition...
                LogError("Missing FsmComponent!");
                return;
            }

            fsmComponent.enabled = enable.Value;
        }
        void DoGetFsmInt()
        {
            if (storeValue == null) return;

            GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);
            if (go == null) return;

            // only get the fsm component if go has changed

            if (go != goLastFrame)
            {
                goLastFrame = go;
                fsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
            }

            if (fsm == null) return;

            FsmInt fsmInt = fsm.FsmVariables.GetFsmInt(variableName.Value);

            if (fsmInt == null) return;

            storeValue.Value = fsmInt.Value;
        }
Example #16
0
        void DoGetFsmColor()
        {
            if (storeValue == null)
            {
                return;
            }

            GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            // only get the fsm component if go has changed

            if (go != goLastFrame)
            {
                goLastFrame = go;
                fsm         = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
            }

            if (fsm == null)
            {
                return;
            }

            FsmColor fsmColor = fsm.FsmVariables.GetFsmColor(variableName.Value);

            if (fsmColor == null)
            {
                return;
            }

            storeValue.Value = fsmColor.Value;
        }
        void DoFsmStateSwitch()
        {
            GameObject go = gameObject.Value;
            if (go == null) return;

            if (go != previousGo)
            {
                fsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
                previousGo = go;
            }

            if (fsm == null) return;

            string activeStateName = fsm.ActiveStateName;

            for (int i = 0; i < compareTo.Length; i++)
            {
                if (activeStateName == compareTo[i].Value)
                {
                    Fsm.Event(sendEvent[i]);
                    return;
                }
            }
        }
        void DoEnableFSM()
        {
            GameObject go = gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value;

            if (go == null) return;

            if (!string.IsNullOrEmpty(fsmName.Value))
            {
                // find by FSM component name

                var fsmComponents = go.GetComponents<managerFSM>();
                foreach (var component in fsmComponents)
                {
                    if (component.FsmName == fsmName.Value)
                    {
                        fsmComponent = component;
                        break;
                    }
                }
            }
            else
            {
                // get first FSM component

                fsmComponent = go.GetComponent<managerFSM>();
            }

            if (fsmComponent == null)
            {
                // TODO: Not sure if this is an error condition...
                LogError("Missing FsmComponent!");
                return;
            }

            fsmComponent.enabled = enable.Value;
        }
        void DoSetFsmString()
        {
            if (setValue == null) return;

            GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);
            if (go == null) return;

            if (go != goLastFrame)
            {
                goLastFrame = go;

                // only get the fsm component if go has changed

                fsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
            }

            if (fsm == null) return;

            FsmString fsmString = fsm.FsmVariables.GetFsmString(variableName.Value);

            if (fsmString == null) return;

            fsmString.Value = setValue.Value;
        }