public void clicked() // Could use maybe some refactoring { if (GameController.instance.canAffordResearch(cost)) { if (researchable is ResearchBlock) { ResearchBlock item = (ResearchBlock)researchable; if (UIController.Instance != null) { UIController.Instance.CreateStructureBlockButton(item.block); } } else if (researchable is ResearchTurret) { ResearchTurret item = (ResearchTurret)researchable; if (UIController.Instance != null) { UIController.Instance.CreateTurretButton(item.block); } } else { return; } nodeData.researched = true; updateChildsButtons(); GameController.instance.removeXP(cost); if (MenuController.instance != null) { MenuController.instance.updateXP(); } setResearched(); } }
private void createToolTipForResearchBlock(ResearchBlock rb) { addTextLineToParent("Type: Structure block", currentToolTip.transform); addTextLineToParent("Cost: " + rb.block.cost + " gold", currentToolTip.transform); addTextLineToParent("HP: " + rb.block.hp, currentToolTip.transform); if (rb.block.name == "Golden") { addTextLineToParent("Special: +10% gold gain per block", currentToolTip.transform); } }