Beispiel #1
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);
        }
Beispiel #2
0
        public void LogAction(SkillLogType logType, string text, bool sendToUnityLog = false)
        {
            if (SkillExecutionStack.ExecutingAction != null)
            {
                SkillLogEntry entry = new SkillLogEntry
                {
                    Log     = this,
                    LogType = logType,
                    State   = SkillExecutionStack.ExecutingState,
                    Action  = SkillExecutionStack.ExecutingAction,
                    Text    = SkillUtility.StripNamespace(SkillExecutionStack.ExecutingAction.ToString()) + " : " + text
                };
                this.AddEntry(entry, sendToUnityLog);
                return;
            }
            switch (logType)
            {
            case SkillLogType.Info:
                Debug.Log(text);
                return;

            case SkillLogType.Warning:
                Debug.LogWarning(text);
                return;

            case SkillLogType.Error:
                Debug.LogError(text);
                return;

            default:
                Debug.Log(text);
                return;
            }
        }
Beispiel #3
0
        public void LogStop()
        {
            SkillLogEntry entry = new SkillLogEntry
            {
                Log     = this,
                LogType = SkillLogType.Stop,
                Text    = "STOP"
            };

            this.AddEntry(entry, false);
        }
Beispiel #4
0
        public void LogStart(SkillState startState)
        {
            SkillLogEntry entry = new SkillLogEntry
            {
                Log     = this,
                LogType = SkillLogType.Start,
                State   = startState,
                Text    = "START"
            };

            this.AddEntry(entry, false);
        }
Beispiel #5
0
        public void Log(SkillLogType logType, string text)
        {
            SkillLogEntry entry = new SkillLogEntry
            {
                Log     = this,
                LogType = logType,
                State   = SkillExecutionStack.ExecutingState,
                Text    = text
            };

            this.AddEntry(entry, false);
        }
Beispiel #6
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);
        }
Beispiel #7
0
        public void LogBreak()
        {
            SkillLogEntry entry = new SkillLogEntry
            {
                Log     = this,
                LogType = SkillLogType.Break,
                State   = SkillExecutionStack.ExecutingState,
                Text    = "BREAK: " + SkillExecutionStack.ExecutingStateName
            };

            Debug.Log("BREAK: " + this.FormatUnityLogString("Breakpoint"));
            this.AddEntry(entry, false);
        }
Beispiel #8
0
        private void AddEntry(SkillLogEntry entry, bool sendToUnityLog = false)
        {
            entry.Log        = this;
            entry.Time       = SkillTime.RealtimeSinceStartup;
            entry.FrameCount = Time.get_frameCount();
            if (SkillLog.IsCollisionEvent(entry.Event))
            {
                entry.GameObject     = entry.Fsm.CollisionGO;
                entry.GameObjectName = entry.Fsm.CollisionName;
            }
            if (SkillLog.IsTriggerEvent(entry.Event))
            {
                entry.GameObject     = entry.Fsm.TriggerGO;
                entry.GameObjectName = entry.Fsm.TriggerName;
            }
            if (SkillLog.IsCollision2DEvent(entry.Event))
            {
                entry.GameObject     = entry.Fsm.Collision2dGO;
                entry.GameObjectName = entry.Fsm.Collision2dName;
            }
            if (SkillLog.IsTrigger2DEvent(entry.Event))
            {
                entry.GameObject     = entry.Fsm.Trigger2dGO;
                entry.GameObjectName = entry.Fsm.Trigger2dName;
            }
            this.entries.Add(entry);
            if (this.entries.get_Count() > 100000)
            {
                this.entries.RemoveRange(0, 10000);
                this.Resized = true;
            }
            switch (entry.LogType)
            {
            case SkillLogType.Warning:
                Debug.LogWarning(this.FormatUnityLogString(entry.Text));
                return;

            case SkillLogType.Error:
                Debug.LogError(this.FormatUnityLogString(entry.Text));
                return;

            default:
                if ((SkillLog.MirrorDebugLog || sendToUnityLog) && entry.LogType != SkillLogType.Transition)
                {
                    Debug.Log(this.FormatUnityLogString(entry.Text));
                }
                return;
            }
        }
Beispiel #9
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);
        }
Beispiel #10
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);
        }
Beispiel #11
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);
        }