public static void upgradeRoom6() { if (!MapGeneratorScript.inventory.containsInventory(CostScript.getCost("room6", room6 + 1))) { Debug.Log("not enough materials in upgrade; this should never happen"); return; } MapGeneratorScript.inventory.removeInventoryContents(CostScript.getCost("room6", room6 + 1)); setRoom6(room6 + 1); sendShipUpgradeInfoToEverybody(); GameObject.Find("Ship Upgrade UI").GetComponent <ShipUIScript>().reloadSprites(); }
public void showDialogue(int index) { Debug.Log("fired at " + index); hideAllDialogues(); GameObject panel = ((GameObject)dialogues[index]).transform.GetChild(0).gameObject.transform.GetChild(0).gameObject; ((GameObject)dialogues[index]).transform.GetChild(0).gameObject.SetActive(true); TextMeshProUGUI canPurchase = panel.transform.GetChild(2).GetComponent <TextMeshProUGUI>(); Inventory costInv = null; Button b = panel.transform.GetChild(3).GetComponent <Button>(); int i = 0; bool maxLevel = false; switch (index) { case 0: i = ProgressionScript.getReactor(); costInv = CostScript.getCost("reactor", i + 1); if (i >= 4) { maxLevel = true; } break; case 1: i = ProgressionScript.getCockpit(); costInv = CostScript.getCost("cockpit", i + 1); if (i >= 2) { maxLevel = true; } break; case 2: i = ProgressionScript.getRoom1(); costInv = CostScript.getCost("room1", i + 1); if (i >= 4) { maxLevel = true; } break; case 3: i = ProgressionScript.getRoom2(); costInv = CostScript.getCost("room2", i + 1); if (i >= 4) { maxLevel = true; } break; case 4: i = ProgressionScript.getRoom3(); costInv = CostScript.getCost("room3", i + 1); if (i >= 4) { maxLevel = true; } break; case 5: i = ProgressionScript.getRoom4(); costInv = CostScript.getCost("room4", i + 1); if (i >= 4) { maxLevel = true; } break; case 6: i = ProgressionScript.getRoom5(); costInv = CostScript.getCost("room5", i + 1); if (i >= 4) { maxLevel = true; } break; case 7: i = ProgressionScript.getRoom6(); costInv = CostScript.getCost("room6", i + 1); if (i >= 4) { maxLevel = true; } break; } if (MapGeneratorScript.inventory.containsInventory(costInv)) { canPurchase.text = "You can purchase this upgrade"; b.interactable = true; } else { canPurchase.text = "You cannot purchase this upgrade"; b.interactable = false; } panel.transform.GetChild(1).GetComponent <TextMeshProUGUI>().text = "Cost: " + costInv.listInventory(); panel.transform.GetChild(3).gameObject.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = "Upgrade to level " + (i + 1); if (maxLevel) { canPurchase.text = "You have already reached max level"; panel.transform.GetChild(3).gameObject.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = "Maxed out"; b.interactable = false; } }
void Awake() { costScript = GameObject.FindObjectOfType <CostScript>(); }