// 开始状态机 public void OnBegin() { #if UNITY_EDITOR RTLog.Log(LogCat.AI, "Begin StateMachine: " + m_Name + " @ " + m_TickCount); #endif m_Active = true; m_Runtime = 0; m_StateRuntime = 0; m_TickCount = 0; m_StateTickCount = 0; m_PrevState = null; m_CurrentState = null; m_CurrentStateName = m_DefaultState; UpdateTransitions(); }
public void OnEnd() { if (m_CurrentState != null) { m_CurrentState.OnEnd(); } #if UNITY_EDITOR RTLog.Log(LogCat.AI, "End StateMachine: " + m_Name + " @ " + m_TickCount); #endif m_TickCount = 0; m_CurrentState = null; m_PrevState = null; m_CurrentStateName = null; m_CurrentTransitions.Clear(); m_Active = false; }
public void OnBegin() { #if UNITY_EDITOR RTLog.Log(LogCat.AI, string.Format("Begin State: {0}/{1}", m_SuperName, m_StateName)); #endif if (Implemention != null) { Implemention.OnBegin(); } else if (m_BeginDelegate != null) { m_BeginDelegate(); } if (m_SubFSM != null) { m_SubFSM.enabled = true; m_SubFSM.FSM.OnBegin(); } }
public void OnEnd() { if (m_SubFSM != null) { m_SubFSM.enabled = false; m_SubFSM.FSM.OnEnd(); } if (Implemention != null) { Implemention.OnEnd(); } else if (m_EndDelegate != null) { m_EndDelegate(); } #if UNITY_EDITOR RTLog.Log(LogCat.AI, string.Format("End State: {0}/{1}", m_SuperName, m_StateName)); #endif }
protected override void OnDestroy() { foreach (var asset in mAssets.Values) { if (!asset.useAb && asset.assetInstence != null) { Resources.UnloadAsset(asset.assetInstence); } asset.assetInstence = null; } mAssets.Clear(); foreach (var ab in mAbs) { if (ab.assetBundle != null) { ab.assetBundle.Unload(true); ab.SetAssetBundle(null); } } #if UNITY_EDITOR RTLog.Log(LogCat.Asset, "All Assets Unloaded."); #endif }