Exemplo n.º 1
0
        public static ActionReport Log(PlayMakerFSM fsm, SkillState state, SkillStateAction action, int actionIndex, string parameter, string logLine, bool isError = false)
        {
            if (!PlayMakerGlobals.IsEditor)
            {
                return(null);
            }
            ActionReport actionReport = new ActionReport
            {
                fsm         = fsm,
                state       = state,
                action      = action,
                actionIndex = actionIndex,
                parameter   = parameter,
                logText     = logLine,
                isError     = isError
            };

            if (!ActionReport.ActionReportContains(actionReport))
            {
                ActionReport.ActionReportList.Add(actionReport);
                ActionReport.InfoCount++;
                return(actionReport);
            }
            return(null);
        }
Exemplo n.º 2
0
 private bool ActivateActions(int startIndex)
 {
     for (int i = startIndex; i < this.Actions.Length; i++)
     {
         this.activeActionIndex = i;
         SkillStateAction fsmStateAction = this.Actions[i];
         if (!fsmStateAction.Enabled)
         {
             fsmStateAction.Finished = true;
         }
         else
         {
             this.ActiveActions.Add(fsmStateAction);
             this.activeAction       = fsmStateAction;
             fsmStateAction.Active   = true;
             fsmStateAction.Finished = false;
             fsmStateAction.Init(this);
             fsmStateAction.Entered = true;
             fsmStateAction.OnEnter();
             if (this.Fsm.IsSwitchingState)
             {
                 return(false);
             }
             if (!fsmStateAction.Finished && this.isSequence)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Exemplo n.º 3
0
 public static string GetPath(SkillState state, SkillStateAction action)
 {
     if (action == null)
     {
         return(SkillUtility.GetPath(state) + "[missing action] ");
     }
     return(SkillUtility.GetPath(state) + action.GetType().get_Name() + ": ");
 }
Exemplo n.º 4
0
 public void OnGUI()
 {
     for (int i = 0; i < this.ActiveActions.get_Count(); i++)
     {
         SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
         fsmStateAction.Init(this);
         fsmStateAction.OnGUI();
     }
     this.RemoveFinishedActions();
 }
Exemplo n.º 5
0
 public void OnLateUpdate()
 {
     for (int i = 0; i < this.ActiveActions.get_Count(); i++)
     {
         SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
         fsmStateAction.Init(this);
         fsmStateAction.OnLateUpdate();
     }
     this.CheckAllActionsFinished();
 }
Exemplo n.º 6
0
 public bool OnJointBreak2D(Joint2D joint)
 {
     for (int i = 0; i < this.ActiveActions.get_Count(); i++)
     {
         SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
         fsmStateAction.Init(this);
         fsmStateAction.DoJointBreak2D(joint);
     }
     this.RemoveFinishedActions();
     return(this.fsm.IsSwitchingState);
 }
Exemplo n.º 7
0
 public bool OnControllerColliderHit(ControllerColliderHit collider)
 {
     for (int i = 0; i < this.ActiveActions.get_Count(); i++)
     {
         SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
         fsmStateAction.Init(this);
         fsmStateAction.DoControllerColliderHit(collider);
     }
     this.RemoveFinishedActions();
     return(this.fsm.IsSwitchingState);
 }
Exemplo n.º 8
0
 public bool OnCollisionExit2D(Collision2D collisionInfo)
 {
     for (int i = 0; i < this.ActiveActions.get_Count(); i++)
     {
         SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
         fsmStateAction.Init(this);
         fsmStateAction.DoCollisionExit2D(collisionInfo);
     }
     this.RemoveFinishedActions();
     return(this.fsm.IsSwitchingState);
 }
Exemplo n.º 9
0
 public bool OnParticleCollision(GameObject other)
 {
     for (int i = 0; i < this.ActiveActions.get_Count(); i++)
     {
         SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
         fsmStateAction.Init(this);
         fsmStateAction.DoParticleCollision(other);
     }
     this.RemoveFinishedActions();
     return(this.fsm.IsSwitchingState);
 }
Exemplo n.º 10
0
 public bool OnAnimatorIK(int layerIndex)
 {
     for (int i = 0; i < this.ActiveActions.get_Count(); i++)
     {
         SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
         fsmStateAction.Init(this);
         fsmStateAction.DoAnimatorIK(layerIndex);
     }
     this.RemoveFinishedActions();
     return(this.fsm.IsSwitchingState);
 }
Exemplo n.º 11
0
 public bool OnTriggerExit2D(Collider2D other)
 {
     for (int i = 0; i < this.ActiveActions.get_Count(); i++)
     {
         SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
         fsmStateAction.Init(this);
         fsmStateAction.DoTriggerExit2D(other);
     }
     this.RemoveFinishedActions();
     return(this.fsm.IsSwitchingState);
 }
Exemplo n.º 12
0
        public bool OnEvent(SkillEvent fsmEvent)
        {
            bool flag = false;

            for (int i = 0; i < this.ActiveActions.get_Count(); i++)
            {
                SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
                fsmStateAction.Init(this);
                flag = fsmStateAction.Event(fsmEvent);
            }
            return(this.fsm.IsSwitchingState || flag);
        }
Exemplo n.º 13
0
 public void OnUpdate()
 {
     if (this.finished)
     {
         return;
     }
     this.StateTime += Time.get_deltaTime();
     for (int i = 0; i < this.ActiveActions.get_Count(); i++)
     {
         SkillStateAction fsmStateAction = this.ActiveActions.get_Item(i);
         fsmStateAction.Init(this);
         fsmStateAction.OnUpdate();
     }
     this.CheckAllActionsFinished();
 }
Exemplo n.º 14
0
 public void OnExit()
 {
     this.active   = false;
     this.finished = false;
     SkillStateAction[] array = this.Actions;
     for (int i = 0; i < array.Length; i++)
     {
         SkillStateAction fsmStateAction = array[i];
         if (fsmStateAction.Entered)
         {
             this.activeAction = fsmStateAction;
             fsmStateAction.Init(this);
             fsmStateAction.OnExit();
         }
     }
 }
Exemplo n.º 15
0
 public SkillEventData(SkillEventData source)
 {
     this.SentByFsm          = source.SentByFsm;
     this.SentByState        = source.SentByState;
     this.SentByAction       = source.SentByAction;
     this.BoolData           = source.BoolData;
     this.IntData            = source.IntData;
     this.FloatData          = source.FloatData;
     this.Vector2Data        = source.Vector2Data;
     this.Vector3Data        = source.Vector3Data;
     this.StringData         = source.StringData;
     this.QuaternionData     = source.QuaternionData;
     this.RectData           = source.RectData;
     this.ColorData          = source.ColorData;
     this.ObjectData         = source.ObjectData;
     this.GameObjectData     = source.GameObjectData;
     this.MaterialData       = source.MaterialData;
     this.TextureData        = source.TextureData;
     this.Player             = source.Player;
     this.DisconnectionInfo  = source.DisconnectionInfo;
     this.ConnectionError    = source.ConnectionError;
     this.NetworkMessageInfo = source.NetworkMessageInfo;
     this.MasterServerEvent  = source.MasterServerEvent;
 }
Exemplo n.º 16
0
 public static void LogError(PlayMakerFSM fsm, SkillState state, SkillStateAction action, int actionIndex, string logLine)
 {
     ActionReport.Log(fsm, state, action, actionIndex, logLine, "", true);
     Debug.LogError(SkillUtility.GetPath(state, action) + logLine, fsm);
     ActionReport.ErrorCount++;
 }
Exemplo n.º 17
0
 public static string GetPath(SkillState state, SkillStateAction action, string parameter)
 {
     return(SkillUtility.GetPath(state, action) + parameter + ": ");
 }
Exemplo n.º 18
0
 public static void RuntimeError(SkillStateAction action, string error)
 {
     action.LogError(action + " : " + error);
 }
Exemplo n.º 19
0
 public void FinishAction(SkillStateAction action)
 {
     this.finishedActions.Add(action);
 }