private void RemoveEntry(FsmLogEntry entry) { if (entries != null) { entries.Remove(entry); } }
public void LogStart(FsmState startState) { FsmLogEntry fsmLogEntry = NewFsmLogEntry(FsmLogType.Start); fsmLogEntry.State = startState; AddEntry(fsmLogEntry); }
public void LogAction(FsmLogType logType, string text, bool sendToUnityLog = false) { if (FsmExecutionStack.ExecutingAction == null) { switch (logType) { case FsmLogType.Info: Debug.Log(text); break; case FsmLogType.Warning: Debug.LogWarning(text); break; case FsmLogType.Error: Debug.LogError(text); break; default: Debug.Log(text); break; } } else { FsmLogEntry fsmLogEntry = NewFsmLogEntry(logType); fsmLogEntry.State = FsmExecutionStack.ExecutingState; fsmLogEntry.Action = FsmExecutionStack.ExecutingAction; fsmLogEntry.Text = FsmUtility.StripNamespace(FsmExecutionStack.ExecutingAction.ToString()) + " : " + text; AddEntry(fsmLogEntry, sendToUnityLog); } }
public void Log(FsmLogType logType, string text) { FsmLogEntry fsmLogEntry = NewFsmLogEntry(logType); fsmLogEntry.State = FsmExecutionStack.ExecutingState; fsmLogEntry.Text = text; AddEntry(fsmLogEntry); }
public void LogBreak() { FsmLogEntry fsmLogEntry = NewFsmLogEntry(FsmLogType.Break); fsmLogEntry.State = FsmExecutionStack.ExecutingState; Debug.Log("BREAK: " + FormatUnityLogString("Breakpoint")); AddEntry(fsmLogEntry); }
public void LogTransition(FsmState fromState, FsmTransition transition) { FsmLogEntry fsmLogEntry = NewFsmLogEntry(FsmLogType.Transition); fsmLogEntry.State = fromState; fsmLogEntry.Transition = transition; AddEntry(fsmLogEntry); }
public void LogEvent(FsmEvent fsmEvent, FsmState state) { FsmLogEntry fsmLogEntry = NewFsmLogEntry(FsmLogType.Event); fsmLogEntry.State = state; fsmLogEntry.SentByState = Fsm.EventData.SentByState; fsmLogEntry.Action = Fsm.EventData.SentByAction; fsmLogEntry.Event = fsmEvent; AddEntry(fsmLogEntry); }
static FsmLog() { MaxSize = 10000; Logs = new List <FsmLog>(); LoggingEnabled = !Application.isEditor; logEntryPool = new FsmLogEntry[MaxSize]; for (int i = 0; i < logEntryPool.Length; i++) { logEntryPool[i] = new FsmLogEntry(); } }
public void LogSendEvent(FsmState state, FsmEvent fsmEvent, FsmEventTarget eventTarget) { if (state != null && fsmEvent != null && !fsmEvent.IsSystemEvent) { FsmLogEntry fsmLogEntry = NewFsmLogEntry(FsmLogType.SendEvent); fsmLogEntry.State = state; fsmLogEntry.Event = fsmEvent; fsmLogEntry.EventTarget = new FsmEventTarget(eventTarget); AddEntry(fsmLogEntry); } }
public void LogEnterState(FsmState state) { if (state != null) { FsmLogEntry fsmLogEntry = NewFsmLogEntry(FsmLogType.EnterState); fsmLogEntry.State = state; if (EnableDebugFlow && state.Fsm.EnableDebugFlow) { fsmLogEntry.FsmVariablesCopy = new FsmVariables(state.Fsm.Variables); fsmLogEntry.GlobalVariablesCopy = new FsmVariables(FsmVariables.GlobalVariables); } AddEntry(fsmLogEntry); } }
public void LogExitState(FsmState state) { if (state != null) { FsmLogEntry fsmLogEntry = NewFsmLogEntry(FsmLogType.ExitState); fsmLogEntry.State = state; fsmLogEntry.StateTime = FsmTime.RealtimeSinceStartup - state.RealStartTime; if (EnableDebugFlow && state.Fsm.EnableDebugFlow && !PlayMakerFSM.ApplicationIsQuitting) { fsmLogEntry.FsmVariablesCopy = new FsmVariables(state.Fsm.Variables); fsmLogEntry.GlobalVariablesCopy = new FsmVariables(FsmVariables.GlobalVariables); } AddEntry(fsmLogEntry); } }
private FsmLogEntry NewFsmLogEntry(FsmLogType logType) { FsmLogEntry fsmLogEntry = logEntryPool[nextLogEntryPoolIndex]; if (fsmLogEntry.Log != null) { fsmLogEntry.Log.RemoveEntry(fsmLogEntry); fsmLogEntry.Reset(); } fsmLogEntry.Log = this; fsmLogEntry.LogType = logType; nextLogEntryPoolIndex++; if (nextLogEntryPoolIndex >= logEntryPool.Length) { nextLogEntryPoolIndex = 0; } return(fsmLogEntry); }
private void AddEntry(FsmLogEntry entry, bool sendToUnityLog = false) { entry.Log = this; entry.Time = FsmTime.RealtimeSinceStartup; entry.FrameCount = Time.frameCount; if (IsCollisionEvent(entry.Event)) { entry.GameObject = entry.Fsm.CollisionGO; entry.GameObjectName = entry.Fsm.CollisionName; } if (IsTriggerEvent(entry.Event)) { entry.GameObject = entry.Fsm.TriggerGO; entry.GameObjectName = entry.Fsm.TriggerName; } if (IsCollision2DEvent(entry.Event)) { entry.GameObject = entry.Fsm.Collision2dGO; entry.GameObjectName = entry.Fsm.Collision2dName; } if (IsTrigger2DEvent(entry.Event)) { entry.GameObject = entry.Fsm.Trigger2dGO; entry.GameObjectName = entry.Fsm.Trigger2dName; } entries.Add(entry); switch (entry.LogType) { case FsmLogType.Error: Debug.LogError(FormatUnityLogString(entry.Text)); return; case FsmLogType.Warning: Debug.LogWarning(FormatUnityLogString(entry.Text)); return; } if ((MirrorDebugLog || sendToUnityLog) && entry.LogType != FsmLogType.Transition) { Debug.Log(FormatUnityLogString(entry.Text)); } }
public void LogStop() { FsmLogEntry entry = NewFsmLogEntry(FsmLogType.Stop); AddEntry(entry); }