public override void SetCurrentTask(BehaviorTask task) { if (task != null) { //if the leaf node is running, then the leaf's parent node is also as running, //the leaf is set as the tree's current task instead of its parent if (this.m_currentTask == null) { Debug.Check(this.m_currentTask != this); this.m_currentTask = task; task.SetHasManagingParent(true); } } else { if (this.m_status != EBTStatus.BT_RUNNING) { this.m_currentTask = task; } } }