Example #1
0
    void CreatePlan(GOAPGoal goal)
    {
        GOAPPlan plan = BuildPlan(goal);

        if (plan == null)
        {
            if (Owner.debugGOAP)
            {
                Debug.Log(Time.timeSinceLevelLoad + " BUILD PLAN - " + goal.ToString() + " FAILED !!! " + Owner.WorldState.ToString(), Owner);
            }
            goal.SetDisableTime();
            return;
        }

        if (CurrentGoal != null)
        {
            CurrentGoal.Deactivate();
            CurrentGoal = null;
        }

        if (Owner.debugGOAP)
        {
            Debug.Log(Time.timeSinceLevelLoad + " BUILD " + goal.ToString() + " - " + plan.ToString() + " " + Owner.WorldState.ToString(), Owner);
            foreach (KeyValuePair <E_GOAPGoals, GOAPGoal> pair in Goals)
            {
                if (pair.Value != goal && pair.Value.GoalRelevancy > 0)
                {
                    Debug.Log(pair.Value.ToString());
                }
            }
        }

        CurrentGoal = goal;
        CurrentGoal.Activate(plan);
    }
Example #2
0
    void CreatePlan(GOAPGoal goal)
    {
        GOAPPlan plan = BuildPlan(goal);

        if (plan == null)
        {
            Debug.LogError(Time.timeSinceLevelLoad + " " + goal.ToString() + " - BUILD PLAN FAILED !!!");
            return;
        }

        CurrentGoal = goal;
        CurrentGoal.Activate(plan);
    }
Example #3
0
    bool ReplanCurrentGoal()
    {
        if (CurrentGoal == null)
        {
            return(false);
        }

        CurrentGoal.ReplanReset();

        GOAPPlan plan = BuildPlan(CurrentGoal);

        if (plan == null)
        {
            //if (Owner.debugGOAP) Debug.Log(Time.timeSinceLevelLoad + " " + CurrentGoal.ToString() + " - REPLAN failed");
            return(false);
        }

        CurrentGoal.Activate(plan);

        return(true);
    }