void DoFsmStatesTest()
        {
            if (fsms == null)
            {
                fsms = new PlayMakerFSM[gameObjects.Length];

                for (var i = 0; i < gameObjects.Length; i++)
                {
                    fsms[i] = ActionHelpers.GetGameObjectFsm(gameObjects[i].Value, "FSM");
                }
            }

            bool allTrue = true;

            for (var i = 0; i < gameObjects.Length; i++)
            {
                if (fsms[i].ActiveStateName != compareTos[i].Value)
                {
                    allTrue = false;
                    break;
                }
            }

            if (allTrue)
            {
                Fsm.Event(allTrueEvent);
            }
            else
            {
                Fsm.Event(notAllTrueEvent);
            }
        }
示例#2
0
        private void DoGetFsmColor()
        {
            if (this.storeValue == null)
            {
                return;
            }
            GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(this.gameObject);

            if (ownerDefaultTarget == null)
            {
                return;
            }
            if (ownerDefaultTarget != this.goLastFrame)
            {
                this.goLastFrame = ownerDefaultTarget;
                this.fsm         = ActionHelpers.GetGameObjectFsm(ownerDefaultTarget, this.fsmName.Value);
            }
            if (this.fsm == null)
            {
                return;
            }
            FsmColor fsmColor = this.fsm.FsmVariables.GetFsmColor(this.variableName.Value);

            if (fsmColor == null)
            {
                return;
            }
            this.storeValue.Value = fsmColor.Value;
        }
示例#3
0
        void DoFsmStateTest()
        {
            var go = gameObject.Value;

            if (go == null)
            {
                return;
            }

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

            if (fsm == null)
            {
                return;
            }

            var isState = false;

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

            storeResult.Value = isState;
        }
示例#4
0
        void InitFsmVar()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            if (go != cachedGO || cachedFsmName != fsmName.Value)
            {
                sourceFsm       = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
                sourceVariable  = sourceFsm.FsmVariables.GetVariable(storeValue.variableName);
                targetVariable  = Fsm.Variables.GetVariable(storeValue.variableName);
                storeValue.Type = targetVariable.VariableType;

                if (!string.IsNullOrEmpty(storeValue.variableName) && sourceVariable == null)
                {
                    LogWarning("Missing Variable: " + storeValue.variableName);
                }

                cachedGO      = go;
                cachedFsmName = fsmName.Value;
            }
        }
示例#5
0
        public override void OnEnter()
        {
            this.go = base.Fsm.GetOwnerDefaultTarget(this.gameObject);
            if (this.go == null)
            {
                base.Finish();
                return;
            }
            PlayMakerFSM gameObjectFsm = ActionHelpers.GetGameObjectFsm(this.go, this.fsmName.Value);

            if (gameObjectFsm == null)
            {
                if (this.requireReceiver)
                {
                    base.LogError("GameObject doesn't have FsmComponent: " + this.go.name + " " + this.fsmName.Value);
                }
                return;
            }
            if ((double)this.delay.Value < 0.001)
            {
                gameObjectFsm.Fsm.Event(this.sendEvent.Value);
                base.Finish();
            }
            else
            {
                this.delayedEvent = gameObjectFsm.Fsm.DelayedEvent(FsmEvent.GetFsmEvent(this.sendEvent.Value), this.delay.Value);
            }
        }
        void DoGetFsmInt()
        {
            GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            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;
            }

            StoreFsmVariable = fsmInt.Value;

            DoIntCompare();
        }
示例#7
0
        void InitFsmVars()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            if (go != cachedGO || cachedFsmName != fsmName.Value)
            {
                sourceVariables = new INamedVariable[getVariables.Length];
                targetVariables = new NamedVariable[getVariables.Length];

                for (var i = 0; i < getVariables.Length; i++)
                {
                    var variableName = getVariables[i].variableName;
                    sourceFsm            = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
                    sourceVariables[i]   = sourceFsm.FsmVariables.GetVariable(variableName);
                    targetVariables[i]   = Fsm.Variables.GetVariable(variableName);
                    getVariables[i].Type = targetVariables[i].VariableType;

                    if (!string.IsNullOrEmpty(variableName) && sourceVariables[i] == null)
                    {
                        LogWarning("Missing Variable: " + variableName);
                    }

                    cachedGO      = go;
                    cachedFsmName = fsmName.Value;
                }
            }
        }
示例#8
0
        private void DoFsmStateSwitch()
        {
            GameObject value = gameObject.Value;

            if (value == null)
            {
                return;
            }
            if (value != previousGo)
            {
                fsm        = ActionHelpers.GetGameObjectFsm(value, fsmName.Value);
                previousGo = value;
            }
            if (fsm == null)
            {
                return;
            }
            string activeStateName = fsm.ActiveStateName;

            for (int i = 0; i < compareTo.Length; i++)
            {
                if (activeStateName == compareTo[i].Value)
                {
                    base.Fsm.Event(sendEvent[i]);
                    break;
                }
            }
        }
示例#9
0
        private void InitFsmVars()
        {
            GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(this.gameObject);

            if (ownerDefaultTarget == null)
            {
                return;
            }
            if (ownerDefaultTarget != this.cachedGO)
            {
                this.sourceVariables = new INamedVariable[this.getVariables.Length];
                this.targetVariables = new NamedVariable[this.getVariables.Length];
                for (int i = 0; i < this.getVariables.Length; i++)
                {
                    string variableName = this.getVariables[i].variableName;
                    this.sourceFsm            = ActionHelpers.GetGameObjectFsm(ownerDefaultTarget, this.fsmName.Value);
                    this.sourceVariables[i]   = this.sourceFsm.FsmVariables.GetVariable(variableName);
                    this.targetVariables[i]   = base.Fsm.Variables.GetVariable(variableName);
                    this.getVariables[i].Type = FsmUtility.GetVariableType(this.targetVariables[i]);
                    if (!string.IsNullOrEmpty(variableName) && this.sourceVariables[i] == null)
                    {
                        base.LogWarning("Missing Variable: " + variableName);
                    }
                    this.cachedGO = ownerDefaultTarget;
                }
            }
        }
示例#10
0
        void DoFlipFsmBool()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            // FIX: must check as well that the fsm name is different.
            if (go != goLastFrame || fsmName.Value != fsmNameLastFrame)
            {
                goLastFrame      = go;
                fsmNameLastFrame = fsmName.Value;
                // only get the fsm component if go or fsm name has changed

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

            if (fsm == null)
            {
                LogWarning("Could not find FSM: " + fsmName.Value);
                return;
            }

            var fsmBool = fsm.FsmVariables.FindFsmBool(variableName.Value);


            {
                fsmBool.Value = !fsmBool.Value;
                Finish();
            }
        }
        void DoGetFsmBool()
        {
            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;
            }

            FsmBool fsmBool = fsm.FsmVariables.GetFsmBool(variableName.Value);

            if (fsmBool == null)
            {
                return;
            }

            storedValue = fsmBool.Value;
        }
示例#12
0
        private void DoSetFsmGameObject()
        {
            GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(gameObject);

            if (ownerDefaultTarget == null)
            {
                return;
            }
            if (ownerDefaultTarget != goLastFrame || fsmName.Value != fsmNameLastFrame)
            {
                goLastFrame      = ownerDefaultTarget;
                fsmNameLastFrame = fsmName.Value;
                fsm = ActionHelpers.GetGameObjectFsm(ownerDefaultTarget, fsmName.Value);
            }
            if (!(fsm == null))
            {
                FsmGameObject fsmGameObject = fsm.FsmVariables.FindFsmGameObject(variableName.Value);
                if (fsmGameObject != null)
                {
                    fsmGameObject.Value = ((setValue == null) ? null : setValue.Value);
                }
                else
                {
                    LogWarning("Could not find variable: " + variableName.Value);
                }
            }
        }
示例#13
0
        private void DoFsmStateTest()
        {
            GameObject value = this.gameObject.Value;

            if (value == null)
            {
                return;
            }
            if (value != this.previousGo)
            {
                this.fsm        = ActionHelpers.GetGameObjectFsm(value, this.fsmName.Value);
                this.previousGo = value;
            }
            if (this.fsm == null)
            {
                return;
            }
            bool value2 = false;

            if (this.fsm.ActiveStateName == this.stateName.Value)
            {
                base.Fsm.Event(this.trueEvent);
                value2 = true;
            }
            else
            {
                base.Fsm.Event(this.falseEvent);
            }
            this.storeResult.Value = value2;
        }
示例#14
0
        void DoSetFsmBool()
        {
            if (loopOverride.Value == 0)
            {
                return;
            }

            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            if (go != goLastFrame || fsmName.Value != fsmNameLastFrame)
            {
                goLastFrame      = go;
                fsmNameLastFrame = fsmName.Value;

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

            if (fsm == null)
            {
                Debug.LogWarning("<color=#FF9900ff><b>Could not find FSM: </b></color>" + fsmName.Value, this.Owner);
                Finish();
            }

            fsm.Fsm.MaxLoopCountOverride = loopOverride.Value;

            if (!everyFrame.Value)
            {
                Finish();
            }
        }
        void Ggop()
        {
            storeResult.Value = false;

            GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }


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

            if (fsm == null)
            {
                return;
            }

            FsmGameObject fsmGameObject = fsm.FsmVariables.GetFsmGameObject(variableName.Value);

            if (fsmGameObject == null)
            {
                return;
            }

            storeFsmValue = fsmGameObject.Value;
        }
示例#16
0
        private void DoFsmStateSwitch()
        {
            GameObject value = this.gameObject.Value;

            if (value == null)
            {
                return;
            }
            if (value != this.previousGo)
            {
                this.fsm        = ActionHelpers.GetGameObjectFsm(value, this.fsmName.Value);
                this.previousGo = value;
            }
            if (this.fsm == null)
            {
                return;
            }
            string activeStateName = this.fsm.ActiveStateName;

            for (int i = 0; i < this.compareTo.Length; i++)
            {
                if (activeStateName == this.compareTo[i].Value)
                {
                    base.Fsm.Event(this.sendEvent[i]);
                    return;
                }
            }
        }
        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;
            }
        }
示例#18
0
        void DoSetFsmGameObject()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            // FIX: must check as well that the fsm name is different.
            if (go != goLastFrame || fsmName.Value != fsmNameLastFrame)
            {
                goLastFrame      = go;
                fsmNameLastFrame = fsmName.Value;
                // only get the fsm component if go or fsm name has changed

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

            if (fsm == null)
            {
                return;
            }

            var fsmGameObject = fsm.FsmVariables.FindFsmGameObject(variableName.Value);

            if (fsmGameObject != null)
            {
                fsmGameObject.Value = setValue == null ? null : setValue.Value;
            }
            else
            {
                LogWarning("Could not find variable: " + variableName.Value);
            }
        }
示例#19
0
        private void DoGetFsmString()
        {
            if (storeValue == null)
            {
                return;
            }
            GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(gameObject);

            if (ownerDefaultTarget == null)
            {
                return;
            }
            if (ownerDefaultTarget != goLastFrame)
            {
                goLastFrame = ownerDefaultTarget;
                fsm         = ActionHelpers.GetGameObjectFsm(ownerDefaultTarget, fsmName.Value);
            }
            if (!(fsm == null))
            {
                FsmString fsmString = fsm.FsmVariables.GetFsmString(variableName.Value);
                if (fsmString != null)
                {
                    storeValue.Value = fsmString.Value;
                }
            }
        }
示例#20
0
        public override void OnEnter()
        {
            go = base.Fsm.GetOwnerDefaultTarget(gameObject);
            if (go == null)
            {
                Finish();
                return;
            }
            PlayMakerFSM gameObjectFsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);

            if (gameObjectFsm == null)
            {
                if (requireReceiver)
                {
                    LogError("GameObject doesn't have FsmComponent: " + go.name + " " + fsmName.Value);
                }
            }
            else if ((double)delay.Value < 0.001)
            {
                gameObjectFsm.Fsm.Event(sendEvent.Value);
                Finish();
            }
            else
            {
                delayedEvent = gameObjectFsm.Fsm.DelayedEvent(FsmEvent.GetFsmEvent(sendEvent.Value), delay.Value);
            }
        }
        void ggop()
        {
            GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

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

            if (fsm == null)
            {
                return;
            }

            FsmFloat fsmFloat = fsm.FsmVariables.GetFsmFloat(variableName.Value);

            if (fsmFloat == null)
            {
                return;
            }

            StoreFsmVariable = fsmFloat.Value;

            ttop();
        }
示例#22
0
        private void DoGetFsmFloat()
        {
            if (storeValue.IsNone)
            {
                return;
            }
            GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(gameObject);

            if (ownerDefaultTarget == null)
            {
                return;
            }
            if (ownerDefaultTarget != goLastFrame)
            {
                fsm         = ActionHelpers.GetGameObjectFsm(ownerDefaultTarget, fsmName.Value);
                goLastFrame = ownerDefaultTarget;
            }
            if (!(fsm == null))
            {
                FsmFloat fsmFloat = fsm.FsmVariables.GetFsmFloat(variableName.Value);
                if (fsmFloat != null)
                {
                    storeValue.Value = fsmFloat.Value;
                }
            }
        }
示例#23
0
        private void DoSetFsmGameObject()
        {
            GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(this.gameObject);

            if (ownerDefaultTarget == null)
            {
                return;
            }
            if (ownerDefaultTarget != this.goLastFrame)
            {
                this.goLastFrame = ownerDefaultTarget;
                this.fsm         = ActionHelpers.GetGameObjectFsm(ownerDefaultTarget, this.fsmName.Value);
            }
            if (this.fsm == null)
            {
                return;
            }
            FsmGameObject fsmGameObject = this.fsm.FsmVariables.FindFsmGameObject(this.variableName.Value);

            if (fsmGameObject != null)
            {
                fsmGameObject.Value = ((this.setValue != null) ? this.setValue.Value : null);
            }
            else
            {
                base.LogWarning("Could not find variable: " + this.variableName.Value);
            }
        }
示例#24
0
        private void DoSetFsmBool()
        {
            if (this.setValue == null)
            {
                return;
            }
            GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(this.gameObject);

            if (ownerDefaultTarget == null)
            {
                return;
            }
            if (ownerDefaultTarget != this.goLastFrame)
            {
                this.goLastFrame = ownerDefaultTarget;
                this.fsm         = ActionHelpers.GetGameObjectFsm(ownerDefaultTarget, this.fsmName.Value);
            }
            if (this.fsm == null)
            {
                this.LogWarning("Could not find FSM: " + this.fsmName.Value);
                return;
            }
            FsmTexture fsmTexture = this.fsm.FsmVariables.FindFsmTexture(this.variableName.Value);

            if (fsmTexture != null)
            {
                fsmTexture.Value = this.setValue.Value;
            }
            else
            {
                this.LogWarning("Could not find variable: " + this.variableName.Value);
            }
        }
示例#25
0
        private void DoGetFsmVariable()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            if (go != goLastFrame || fsmName.Value != fsmNameLastFrame)
            {
                goLastFrame      = go;
                fsmNameLastFrame = fsmName.Value;
                // only get the fsm component if go or fsm name has changed
                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;
            }
        }
示例#26
0
        void DoFsmVariableTest()
        {
            var go = gameObject.Value;

            if (go == null)
            {
                return;
            }

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

            if (fsm == null)
            {
                return;
            }

            var hasVariable = false;

            if (fsm.FsmVariables.Contains(variableName.Value))
            {
                Fsm.Event(trueEvent);
                hasVariable = true;
            }
            else
            {
                Fsm.Event(falseEvent);
            }

            storeResult.Value = hasVariable;
        }
示例#27
0
        private void DoSetFsmString()
        {
            if (setValue == null)
            {
                return;
            }
            GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(gameObject);

            if (ownerDefaultTarget == null)
            {
                return;
            }
            if (ownerDefaultTarget != goLastFrame || fsmName.Value != fsmNameLastFrame)
            {
                goLastFrame      = ownerDefaultTarget;
                fsmNameLastFrame = fsmName.Value;
                fsm = ActionHelpers.GetGameObjectFsm(ownerDefaultTarget, fsmName.Value);
            }
            if (fsm == null)
            {
                LogWarning("Could not find FSM: " + fsmName.Value);
                return;
            }
            FsmString fsmString = fsm.FsmVariables.GetFsmString(variableName.Value);

            if (fsmString != null)
            {
                fsmString.Value = setValue.Value;
            }
            else
            {
                LogWarning("Could not find variable: " + variableName.Value);
            }
        }
示例#28
0
        void DoFsmStateSwitch()
        {
            var go = gameObject.Value;

            if (go == null)
            {
                return;
            }

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

            if (fsm == null)
            {
                return;
            }

            var activeStateName = fsm.ActiveStateName;

            for (var i = 0; i < compareTo.Length; i++)
            {
                if (activeStateName == compareTo[i].Value)
                {
                    Fsm.Event(sendEvent[i]);
                    return;
                }
            }
        }
        void Ggop()
        {
            GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);

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

            if (fsm == null)
            {
                return;
            }

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

            if (fsmString == null)
            {
                return;
            }

            storeFsmValue = fsmString.Value;
        }
示例#30
0
        public override void OnEnter()
        {
            go = gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value;

            if (go == null)
            {
                Finish();
                return;
            }

            PlayMakerFSM sendToFsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);

            if (sendToFsm == null)
            {
                if (requireReceiver)
                {
                    ActionHelpers.RuntimeError(this, "GameObject doesn't have FsmComponent: " + go.name + " " + fsmName.Value);
                }

                return;
            }

            delayedEvent = new DelayedEvent(sendToFsm, sendEvent.Value, delay.Value);
            delayedEvent.Update();
        }