Ejemplo n.º 1
0
 public override void ResetNode()
 {
     if (m_listener_context != null)
     {
         Entity owner = m_context.GetData <Entity>(BTContextKey.OwnerEntity);
         for (int i = 0; i < m_signal_datas.Count; ++i)
         {
             owner.RemoveListener(m_signal_datas[i].m_signal_id, m_listener_context.ID);
         }
         SignalListenerContext.Recycle(m_listener_context);
         m_listener_context = null;
         m_context.GetLogicWorld().UnregisterBehaviorTree(this);
         m_register_id = 0;
     }
     ClearRunningTrace();
     base.ResetNode();
     if (m_context != null)
     {
         BTContext context = m_context;
         SetContext(null);
         RecyclableObject.Recycle(context);
     }
     m_current_running_entry_index = -1;
     if (m_task != null)
     {
         m_task.Cancel();
         LogicTask.Recycle(m_task);
         m_task = null;
     }
 }
Ejemplo n.º 2
0
 public void Construct(LogicWorld logic_world)
 {
     if (m_context == null)
     {
         BTContext context = RecyclableObject.Create <BTContext>();
         context.Construct(logic_world, this);
         SetContext(context);
     }
     if (m_task == null)
     {
         m_task = LogicTask.Create <BehaviorTreeTask>();
         m_task.Construct(this);
     }
 }