void Update() { int[] currInventory = playerScript.GetInventory(); for (int i = 1; i < 8; i++) { // The first getchild gets the row, the second gets the column of the state table. Text inv = transform.GetChild(i).GetChild(1).gameObject.GetComponent <Text>(); Text car = transform.GetChild(i).GetChild(2).gameObject.GetComponent <Text>(); inv.text = "" + currInventory[i - 1]; car.text = "" + caravanScript.getSpiceCount(i - 1); } }
// 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"); }