Exemple #1
0
    public override void Reset()
    {
        base.Reset();

        if (m_tree != null)
        {
            m_tree.Reset();
        }
    }
Exemple #2
0
 void AIUpdate()
 {
     if (_tree.Tick() != BehaveResult.Running)
     {
         Debug.Log("Resetting tree!");
         _tree.Reset();
     }
 }
Exemple #3
0
        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);
            }
        }