Exemple #1
0
    private IEnumerator NewPlan()
    {
        blackBoard.UpdateTargets();
        currentGoal = GetNewGoal();
        viewControl.SetGoal(currentGoal);
        plan = currentGoal.TryGetPlan(playerWorldState, playerActions);
        if (plan == null)
        {
            Debug.LogWarning("Plan war null for: " + currentGoal.GetType());
        }

        yield return(new WaitForSecondsRealtime(ActionDelay));

        viewControl.SetPlan(plan);
        if (plan.Count > 0)
        {
            if (currentAction.GetType() == typeof(MovingAction_Goap))
            {
                ((MovingAction_Goap)currentAction).Unload();
            }
            ;
            currentAction = playerActionLookup[plan.Dequeue()];
            currentAction.Enter();
        }
    }
Exemple #2
0
    /// <summary>
    /// Blir tydligare för debugningen att kolla med en paus på 0.5s
    /// </summary>
    /// <returns>The action.</returns>
    private IEnumerator NextAction()
    {
        yield return(new WaitForSecondsRealtime(ActionDelay));

        if (plan.Count > 0)
        {
            if (currentAction.GetType() == typeof(MovingAction_Goap))
            {
                ((MovingAction_Goap)currentAction).Unload();
            }
            ;
            currentAction = playerActionLookup[plan.Dequeue()];
            currentAction.Enter();
        }
    }
Exemple #3
0
    private void CreateNewPlan()
    {
        currentGoal = GetNewGoal();
        viewControl.SetGoal(currentGoal);

        plan = currentGoal.TryGetPlan(playerWorldState, playerActions);


        viewControl.SetPlan(plan);

        if (plan.Count > 0)
        {
            currentAction = playerActionLookup[plan.Dequeue()];
            currentAction.Enter();
        }
    }