Exemple #1
0
 public GoapNode(GoapNode parent, GoapAction action, GoapStatus status, float cost)
 {
     parentNode    = parent;
     goapAction    = action;
     currentStatus = status;
     this.cost     = cost;
 }
Exemple #2
0
    private void GetGoal()
    {
        GoapStatus goapStatus = goapGoal.GetGoalStatus();
        Dictionary <GoapCondition, object> statusDic = goapStatus.Status();

        sb.Remove(0, sb.Length);

        sb.AppendLine("Goal:");
        foreach (var pair in statusDic)
        {
            string status = string.Format("{0}:{1}", pair.Key.ToString(), pair.Value.ToString());
            sb.AppendLine(status);
        }

        SetText(goalText, sb.ToString());
    }
    public GoapAction GetPerformerAction()
    {
        GoapAction goapAction = null;

        if (goapActionQueue.Count <= 0)
        {
            GoapStatus worldStatus = goapGoal.GetWorldStatus();
            GoapStatus goalStatus  = goapGoal.GetGoalStatus();

            goapActionQueue = goapPlan.Plan(usableGoapActionList, worldStatus, goalStatus);
        }

        if (goapActionQueue.Count <= 0)
        {
            return(goapAction);
        }

        goapAction = goapActionQueue.Dequeue();
        return(goapAction);
    }
Exemple #4
0
    public GoapAction GetPerformerAction()
    {
        Queue <GoapAction> goapActionQueue = new Queue <GoapAction>();
        GoapAction         goapAction      = null;

        if (goapActionQueue.Count <= 0)
        {
            GoapStatus worldStatus = goapAgent.GoapStateManager.GetWorldStatus();
            GoapStatus goalStatus  = goapAgent.GoapStateManager.GetGoalStatus();

            List <GoapAction> usableGoapActionList = goapAgent.GoapActionManager.GetActions();
            goapActionQueue = goapPlan.Plan(usableGoapActionList, worldStatus, goalStatus);
        }

        if (goapActionQueue.Count <= 0)
        {
            return(goapAction);
        }

        goapAction = goapActionQueue.Dequeue();
        return(goapAction);
    }