Пример #1
0
        private static SetVelocity2d _getOrCacheFSMSetVelocity2D(string stateName, string fsmName, GameObject go, int index)
        {
            SetVelocity2d outVal = null;

            PlayMakerFSM myFsm = _getOrCacheFSM(fsmName, go);

            if (index < 0)
            {
                FsmState myState;
                if (myFsm != null)
                {
                    myState = myFsm.GetState(stateName);
                }
                else
                {
                    return(null);
                }
                if (myState != null)
                {
                    outVal = (SetVelocity2d)myState.Actions.FirstOrDefault(setVelo => setVelo is SetVelocity2d);
                }

                return(outVal);
            }
            else
            {
                return(FsmUtil.GetAction <SetVelocity2d>(myFsm, stateName, index));
            }
        }
Пример #2
0
 public SetVelocity2DData(float magnitudeFactor, SetVelocity2d cachedVelo2D)
 {
     MagnitudeFactor   = magnitudeFactor;
     this.cachedVelo2D = cachedVelo2D;
     CustomGameObject  = cachedVelo2D.Owner;
     FSMName           = cachedVelo2D.Fsm.Name;
     FSMStateName      = cachedVelo2D.State.Name;
     ElementIndex      = -1;
     DefaultMagnitude  = Vector2.zero;
 }
Пример #3
0
            public SetVelocity2DData(float magnitudeFactor, string fsmName, string fsmStateName, int elementIndex = -1,
                                     GameObject customGameObject = null)
            {
                CustomGameObject  = customGameObject;
                FSMName           = fsmName;
                FSMStateName      = fsmStateName;
                MagnitudeFactor   = magnitudeFactor;
                DefaultMagnitude  = Vector2.zero;
                this.cachedVelo2D = null;

                this.ElementIndex = elementIndex;
            }