예제 #1
0
    // Method to find the first unfulfilled goal and create a plan based on this with the help of the Graph.cs class
    private void MakePlan()
    {
        for (int i = 0; i < 7; i++)
        {
            if (caravan.getSpiceCount(i) >= goals[i][i]) // Goal fulfilled so we skip it
            {
                continue;
            }

            // Create graph with the found unfulfilled goal as the goal, and with the current world state
            Graph graph = new Graph(allActions, player.GetInventory(), caravan.GetAllSpiceCounts(), goals[i]);
            plan = new Queue<AbstractAction>(graph.FindPlan());
            return; // Plan has been constructed so we exit the mehtod
        }
        planDisplay.GetComponent<Plan>().DisplayMessage("All Goals Completed");
    }