Ejemplo n.º 1
0
 private bool ActivateActions(int startIndex)
 {
     for (int i = startIndex; i < Actions.Length; i++)
     {
         activeActionIndex = i;
         FsmStateAction fsmStateAction = Actions[i];
         if (!fsmStateAction.Enabled)
         {
             fsmStateAction.Finished = true;
             continue;
         }
         ActiveActions.Add(fsmStateAction);
         activeAction            = fsmStateAction;
         fsmStateAction.Active   = true;
         fsmStateAction.Finished = false;
         fsmStateAction.Init(this);
         fsmStateAction.Entered = true;
         fsmStateAction.OnEnter();
         if (Fsm.IsSwitchingState)
         {
             return(false);
         }
         if (!fsmStateAction.Finished && isSequence)
         {
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 2
0
        public static ActionReport Log(PlayMakerFSM fsm, FsmState state, FsmStateAction action, int actionIndex, string parameter, string logLine, bool isError = false)
        {
            if (!PlayMakerGlobals.IsEditor)
            {
                return(null);
            }
            ActionReport actionReport = new ActionReport();

            actionReport.fsm         = fsm;
            actionReport.state       = state;
            actionReport.action      = action;
            actionReport.actionIndex = actionIndex;
            actionReport.parameter   = parameter;
            actionReport.logText     = logLine;
            actionReport.isError     = isError;
            ActionReport actionReport2 = actionReport;

            if (!ActionReportContains(actionReport2))
            {
                ActionReportList.Add(actionReport2);
                InfoCount++;
                return(actionReport2);
            }
            return(null);
        }
Ejemplo n.º 3
0
 public static string GetPath(FsmState state, FsmStateAction action)
 {
     if (action == null)
     {
         return(GetPath(state) + "[missing action] ");
     }
     return(GetPath(state) + action.GetType().Name + ": ");
 }
Ejemplo n.º 4
0
 public void OnGUI()
 {
     for (int i = 0; i < ActiveActions.Count; i++)
     {
         FsmStateAction fsmStateAction = ActiveActions[i];
         fsmStateAction.Init(this);
         fsmStateAction.OnGUI();
     }
     RemoveFinishedActions();
 }
Ejemplo n.º 5
0
 public void OnLateUpdate()
 {
     for (int i = 0; i < ActiveActions.Count; i++)
     {
         FsmStateAction fsmStateAction = ActiveActions[i];
         fsmStateAction.Init(this);
         fsmStateAction.OnLateUpdate();
     }
     CheckAllActionsFinished();
 }
Ejemplo n.º 6
0
 public bool OnJointBreak2D(Joint2D joint)
 {
     for (int i = 0; i < ActiveActions.Count; i++)
     {
         FsmStateAction fsmStateAction = ActiveActions[i];
         fsmStateAction.Init(this);
         fsmStateAction.DoJointBreak2D(joint);
     }
     RemoveFinishedActions();
     return(fsm.IsSwitchingState);
 }
Ejemplo n.º 7
0
 public bool OnControllerColliderHit(ControllerColliderHit collider)
 {
     for (int i = 0; i < ActiveActions.Count; i++)
     {
         FsmStateAction fsmStateAction = ActiveActions[i];
         fsmStateAction.Init(this);
         fsmStateAction.DoControllerColliderHit(collider);
     }
     RemoveFinishedActions();
     return(fsm.IsSwitchingState);
 }
Ejemplo n.º 8
0
 public bool OnTriggerExit2D(Collider2D other)
 {
     for (int i = 0; i < ActiveActions.Count; i++)
     {
         FsmStateAction fsmStateAction = ActiveActions[i];
         fsmStateAction.Init(this);
         fsmStateAction.DoTriggerExit2D(other);
     }
     RemoveFinishedActions();
     return(fsm.IsSwitchingState);
 }
Ejemplo n.º 9
0
 public bool OnCollisionExit2D(Collision2D collisionInfo)
 {
     for (int i = 0; i < ActiveActions.Count; i++)
     {
         FsmStateAction fsmStateAction = ActiveActions[i];
         fsmStateAction.Init(this);
         fsmStateAction.DoCollisionExit2D(collisionInfo);
     }
     RemoveFinishedActions();
     return(fsm.IsSwitchingState);
 }
Ejemplo n.º 10
0
 public bool OnParticleCollision(GameObject other)
 {
     for (int i = 0; i < ActiveActions.Count; i++)
     {
         FsmStateAction fsmStateAction = ActiveActions[i];
         fsmStateAction.Init(this);
         fsmStateAction.DoParticleCollision(other);
     }
     RemoveFinishedActions();
     return(fsm.IsSwitchingState);
 }
Ejemplo n.º 11
0
 public bool OnAnimatorIK(int layerIndex)
 {
     for (int i = 0; i < ActiveActions.Count; i++)
     {
         FsmStateAction fsmStateAction = ActiveActions[i];
         fsmStateAction.Init(this);
         fsmStateAction.DoAnimatorIK(layerIndex);
     }
     RemoveFinishedActions();
     return(fsm.IsSwitchingState);
 }
Ejemplo n.º 12
0
 public void OnUpdate()
 {
     if (!finished)
     {
         StateTime += Time.deltaTime;
         for (int i = 0; i < ActiveActions.Count; i++)
         {
             FsmStateAction fsmStateAction = ActiveActions[i];
             fsmStateAction.Init(this);
             fsmStateAction.OnUpdate();
         }
         CheckAllActionsFinished();
     }
 }
Ejemplo n.º 13
0
 public void OnExit()
 {
     active   = false;
     finished = false;
     FsmStateAction[] array = Actions;
     foreach (FsmStateAction fsmStateAction in array)
     {
         if (fsmStateAction.Entered)
         {
             activeAction = fsmStateAction;
             fsmStateAction.Init(this);
             fsmStateAction.OnExit();
         }
     }
 }
Ejemplo n.º 14
0
        public bool OnEvent(FsmEvent fsmEvent)
        {
            bool result = false;

            for (int i = 0; i < ActiveActions.Count; i++)
            {
                FsmStateAction fsmStateAction = ActiveActions[i];
                fsmStateAction.Init(this);
                result = fsmStateAction.Event(fsmEvent);
            }
            if (!fsm.IsSwitchingState)
            {
                return(result);
            }
            return(true);
        }
Ejemplo n.º 15
0
 public FsmEventData(FsmEventData source)
 {
     SentByFsm          = source.SentByFsm;
     SentByState        = source.SentByState;
     SentByAction       = source.SentByAction;
     BoolData           = source.BoolData;
     IntData            = source.IntData;
     FloatData          = source.FloatData;
     Vector2Data        = source.Vector2Data;
     Vector3Data        = source.Vector3Data;
     StringData         = source.StringData;
     QuaternionData     = source.QuaternionData;
     RectData           = source.RectData;
     ColorData          = source.ColorData;
     ObjectData         = source.ObjectData;
     GameObjectData     = source.GameObjectData;
     MaterialData       = source.MaterialData;
     TextureData        = source.TextureData;
     Player             = source.Player;
     DisconnectionInfo  = source.DisconnectionInfo;
     ConnectionError    = source.ConnectionError;
     NetworkMessageInfo = source.NetworkMessageInfo;
     MasterServerEvent  = source.MasterServerEvent;
 }
Ejemplo n.º 16
0
 public void FinishAction(FsmStateAction action)
 {
     finishedActions.Add(action);
 }
Ejemplo n.º 17
0
 public static void LogError(PlayMakerFSM fsm, FsmState state, FsmStateAction action, int actionIndex, string logLine)
 {
     Log(fsm, state, action, actionIndex, logLine, "", isError: true);
     Debug.LogError(FsmUtility.GetPath(state, action) + logLine, fsm);
     ErrorCount++;
 }
Ejemplo n.º 18
0
 /// <summary>
 /// [-Convert]ActionName: fromVar to toVar
 /// </summary>
 public static string AutoNameConvert(FsmStateAction action, NamedVariable fromVariable, NamedVariable toVariable)
 {
     return(action == null ? null : AutoNameConvert(action.GetType().Name, fromVariable, toVariable));
 }
Ejemplo n.º 19
0
 /// <summary>
 /// ActionName: property -> store
 /// </summary>
 public static string AutoNameGetProperty(FsmStateAction action, NamedVariable property, NamedVariable store)
 {
     return(action == null ? null : AutoNameGetProperty(action.GetType().Name, property, store));
 }
Ejemplo n.º 20
0
 /// <summary>
 /// ActionName: min - max
 /// </summary>
 public static string AutoNameRange(FsmStateAction action, NamedVariable min, NamedVariable max)
 {
     return(action == null ? null : AutoNameRange(action.GetType().Name, min, max));
 }
Ejemplo n.º 21
0
 /// <summary>
 /// ActionName: var = value
 /// </summary>
 public static string AutoNameSetVar(FsmStateAction action, NamedVariable var, NamedVariable value)
 {
     return(action == null ? null : AutoNameSetVar(action.GetType().Name, var, value));
 }
Ejemplo n.º 22
0
 /// <summary>
 /// ActionName: event
 /// </summary>
 public static string AutoName(FsmStateAction action, FsmEvent fsmEvent)
 {
     return(action == null ? null : AutoName(action.GetType().Name, fsmEvent != null ? fsmEvent.Name : "None"));
 }
Ejemplo n.º 23
0
 /// <summary>
 /// ActionName: ownerDefault field1 field2 ...
 /// </summary>
 public static string AutoName(FsmStateAction action, Fsm fsm, FsmOwnerDefault target, params INamedVariable[] exposedFields)
 {
     return(action == null ? null : AutoName(action.GetType().Name, fsm, target, exposedFields));
 }
Ejemplo n.º 24
0
 /// <summary>
 /// ActionName: ownerDefault
 /// </summary>
 public static string AutoName(FsmStateAction action, Fsm fsm, FsmOwnerDefault ownerDefault)
 {
     return(action == null ? null : AutoName(action.GetType().Name, GetValueLabel(fsm, ownerDefault)));
 }
Ejemplo n.º 25
0
 /// <summary>
 /// ActionName: label1 label2 ...
 /// </summary>
 public static string AutoName(FsmStateAction action, params string[] labels)
 {
     return(action == null ? null : AutoName(action.GetType().Name, labels));
 }
Ejemplo n.º 26
0
 /// <summary>
 /// ActionName: field1 field2 ...
 /// </summary>
 public static string AutoName(FsmStateAction action, params INamedVariable[] exposedFields)
 {
     return(action == null ? null : AutoName(action.GetType().Name, exposedFields));
 }
Ejemplo n.º 27
0
 public static void RuntimeError(FsmStateAction action, string error)
 {
     action.LogError(action + colon + error);
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Get the GameObject targeted by an action's FsmOwnerDefault variable
 /// </summary>
 public static GameObject GetOwnerDefault(FsmStateAction action, FsmOwnerDefault ownerDefault)
 {
     return(action.Fsm.GetOwnerDefaultTarget(ownerDefault));
 }
Ejemplo n.º 29
0
 public static string GetPath(FsmState state, FsmStateAction action, string parameter)
 {
     return(GetPath(state, action) + parameter + ": ");
 }
Ejemplo n.º 30
0
 public static void RuntimeError(FsmStateAction action, string error)
 {
     action.LogError(string.Concat(action, " : ", error));
 }