void AIUpdate() { if (_tree.Tick() != BehaveResult.Running) { Debug.Log("Resetting tree!"); _tree.Reset(); } }
BehaveResult AiUpdate() { return(m_tree.Tick()); //try //{ // return m_tree.Tick(); //} //catch (System.Exception ex) //{ // Debug.LogError("Ai Tick : { " + ex.Message + " }"); // return BehaveResult.Failure; //} }
IEnumerator Runner() { WaitForSeconds wait = new WaitForSeconds(1 / m_Tree.Frequency); while (m_Tree != null) { if (CanRun()) { #if Profiler_Debug m_ActiveAction = System.Enum.ToObject(m_Tree.LibraryActions, m_Tree.LastTickedAction).ToString(); #endif #if Profiler_Debug Profiler.BeginSample(m_ActiveAction); #endif try { m_LastTickResult = m_Tree.Tick(m_Agent, null); } catch (Exception e) { Debug.LogWarning("Tree Tick Error : " + e); } #if Profiler_Debug Profiler.EndSample(); #endif if (m_LastTickResult != BehaveResult.Running) { m_Tree.Reset(); } } yield return(wait); } }
//--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Public Member Functions //--------------------------------------------------------------------------- public IEnumerator Start() { m_Tree = BLOpenCogCharacterBehaviours.InstantiateTree (TreeType.CharacterBehaviours_RobotExploreBehaviour , this ) ; while (Application.isPlaying && m_Tree != null) { yield return(new WaitForSeconds(1.0f / m_Tree.Frequency)); m_Tree.Tick(); } }
void AIUpdate() { m_Tree.Tick(); }