コード例 #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);
        }
コード例 #2
0
 public virtual void Init(SkillState state)
 {
     this.fsmState     = state;
     this.fsm          = state.Fsm;
     this.owner        = this.fsm.GameObject;
     this.fsmComponent = this.fsm.FsmComponent;
 }
コード例 #3
0
        public void LogExitState(SkillState state)
        {
            if (state == null)
            {
                return;
            }
            SkillLogEntry fsmLogEntry = new SkillLogEntry
            {
                Log     = this,
                LogType = SkillLogType.ExitState,
                State   = state,
                Text    = string.Concat(new string[]
                {
                    "EXIT: ",
                    state.Name,
                    " [",
                    string.Format("{0:f2}", SkillTime.RealtimeSinceStartup - state.RealStartTime),
                    "s]"
                })
            };

            if (SkillLog.EnableDebugFlow && state.Fsm.EnableDebugFlow && !PlayMakerFSM.ApplicationIsQuitting)
            {
                fsmLogEntry.FsmVariablesCopy    = new SkillVariables(state.Fsm.Variables);
                fsmLogEntry.GlobalVariablesCopy = new SkillVariables(SkillVariables.GlobalVariables);
            }
            this.AddEntry(fsmLogEntry, false);
        }
コード例 #4
0
 public static string CheckForValidEvent(SkillState state, string eventName)
 {
     if (state == null)
     {
         return("Invalid State!");
     }
     if (string.IsNullOrEmpty(eventName))
     {
         return("");
     }
     SkillTransition[] globalTransitions = state.Fsm.GlobalTransitions;
     for (int i = 0; i < globalTransitions.Length; i++)
     {
         SkillTransition fsmTransition = globalTransitions[i];
         if (fsmTransition.EventName == eventName)
         {
             string result = "";
             return(result);
         }
     }
     SkillTransition[] transitions = state.Transitions;
     for (int j = 0; j < transitions.Length; j++)
     {
         SkillTransition fsmTransition2 = transitions[j];
         if (fsmTransition2.EventName == eventName)
         {
             string result = "";
             return(result);
         }
     }
     return("Fsm will not respond to Event: " + eventName);
 }
コード例 #5
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() + ": ");
 }
コード例 #6
0
 public static string GetPath(SkillState state)
 {
     if (state == null)
     {
         return("[missing state]");
     }
     return(((state.Fsm != null) ? (state.Fsm.OwnerDebugName + ": " + state.Fsm.Name) : "[missing FSM]") + ": " + state.Name + ": ");
 }
コード例 #7
0
 public static string GetFullStateLabel(SkillState state)
 {
     if (state == null)
     {
         return("None (State)");
     }
     return(Skill.GetFullFsmLabel(state.Fsm) + " : " + state.Name);
 }
コード例 #8
0
        public void LogStart(SkillState startState)
        {
            SkillLogEntry entry = new SkillLogEntry
            {
                Log     = this,
                LogType = SkillLogType.Start,
                State   = startState,
                Text    = "START"
            };

            this.AddEntry(entry, false);
        }
コード例 #9
0
        public void LogTransition(SkillState fromState, SkillTransition transition)
        {
            SkillLogEntry entry = new SkillLogEntry
            {
                Log        = this,
                LogType    = SkillLogType.Transition,
                State      = fromState,
                Transition = transition
            };

            this.AddEntry(entry, false);
        }
コード例 #10
0
        public void LogEvent(SkillEvent fsmEvent, SkillState state)
        {
            SkillLogEntry entry = new SkillLogEntry
            {
                Log         = this,
                LogType     = SkillLogType.Event,
                State       = state,
                SentByState = Skill.EventData.SentByState,
                Action      = Skill.EventData.SentByAction,
                Event       = fsmEvent,
                Text        = "EVENT: " + fsmEvent.Name
            };

            this.AddEntry(entry, false);
        }
コード例 #11
0
 public static int GetStateIndex(SkillState state)
 {
     if (state.Fsm == null)
     {
         return(-1);
     }
     for (int i = 0; i < state.Fsm.States.Length; i++)
     {
         SkillState fsmState = state.Fsm.States[i];
         if (fsmState == state)
         {
             return(i);
         }
     }
     Debug.LogError("State not in FSM!");
     return(-1);
 }
コード例 #12
0
 public SkillState(SkillState source)
 {
     this.fsm          = source.Fsm;
     this.name         = source.Name;
     this.description  = source.description;
     this.colorIndex   = source.colorIndex;
     this.position     = new Rect(source.position);
     this.hideUnused   = source.hideUnused;
     this.isBreakpoint = source.isBreakpoint;
     this.isSequence   = source.isSequence;
     this.transitions  = new SkillTransition[source.transitions.Length];
     for (int i = 0; i < source.Transitions.Length; i++)
     {
         this.transitions[i] = new SkillTransition(source.Transitions[i]);
     }
     this.actionData = source.actionData.Copy();
 }
コード例 #13
0
        public void LogSendEvent(SkillState state, SkillEvent fsmEvent, SkillEventTarget eventTarget)
        {
            if (state == null || fsmEvent == null || fsmEvent.IsSystemEvent)
            {
                return;
            }
            SkillLogEntry entry = new SkillLogEntry
            {
                Log         = this,
                LogType     = SkillLogType.SendEvent,
                State       = state,
                Event       = fsmEvent,
                Text        = "SEND EVENT: " + fsmEvent.Name,
                EventTarget = new SkillEventTarget(eventTarget)
            };

            this.AddEntry(entry, false);
        }
コード例 #14
0
        public void LogEnterState(SkillState state)
        {
            if (state == null)
            {
                return;
            }
            SkillLogEntry fsmLogEntry = new SkillLogEntry
            {
                Log     = this,
                LogType = SkillLogType.EnterState,
                State   = state,
                Text    = "ENTER: " + state.Name
            };

            if (SkillLog.EnableDebugFlow && state.Fsm.EnableDebugFlow)
            {
                fsmLogEntry.FsmVariablesCopy    = new SkillVariables(state.Fsm.Variables);
                fsmLogEntry.GlobalVariablesCopy = new SkillVariables(SkillVariables.GlobalVariables);
            }
            this.AddEntry(fsmLogEntry, false);
        }
コード例 #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;
 }
コード例 #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++;
 }
コード例 #17
0
 public static string GetPath(SkillState state, SkillStateAction action, string parameter)
 {
     return(SkillUtility.GetPath(state, action) + parameter + ": ");
 }
コード例 #18
0
 public void CopyActionData(SkillState state)
 {
     this.actionData = state.actionData.Copy();
 }