Example #1
0
        protected void PlanGenerated(GoalPlanPair <TKey, TValue> _goalPlanPair)
        {
            m_UnhandledSensorChanges    = false;
            m_LastPlanningTimeInSeconds = Time.realtimeSinceStartup;

            if (_goalPlanPair.GoalInstance == null)
            {
                return;
            }

            OnBeforeNewPlan?.Invoke();
            m_ActiveAction?.Cancel();
            SetActiveGoal(_goalPlanPair.GoalInstance);

            m_Plan         = _goalPlanPair.PlanInstance;
            m_IsPlanLocked = false;
            m_IndexInPlan  = 0;

            if (!m_Plan.Empty())
            {
                m_ActiveAction = m_Plan.Pop();
            }
            else
            {
                m_ActiveAction = null;
            }

            OnNewPlan?.Invoke();
            OnPlanProgressed?.Invoke();
        }
Example #2
0
        private void OnActionCompleted()
        {
            if (m_Plan.Empty())
            {
                m_ActiveAction = null;
                m_ActiveGoal   = null;
                m_IsPlanLocked = false;
            }
            else
            {
                m_ActiveAction = m_Plan.Pop();
            }

            OnPlanProgressed?.Invoke();
        }