private void Start() { ElementType = Element.ROCKET; Upgrades = new TowerUpgrades[] { //Flame Tower Constructors new TowerUpgrades(2, 2, 1, 2), new TowerUpgrades(5, 3, 1, 2), }; }
// Start is called before the first frame update void Start() { Level = 1; Upgrades = new TowerUpgrades[] { new TowerUpgrades((this.Price / 4), 2, 0.5f, 10, 0.1f, 1, 10), new TowerUpgrades((this.Price / 3), 3, 0.5f, 10, 0.1f, 1, 15), new TowerUpgrades((this.Price / 2), 4, 0.5f, 10, 0.1f, 1, 20) }; myAnimator = transform.parent.GetComponent <Animator>(); parent = this.transform.parent.gameObject; mySprite = GetComponent <SpriteRenderer>(); }
public void SelectTower(GameObject t) { if (SelectedTower != null) { //Εμφανίζει το μενου των tower (Upgrade Tower, Sell Tower) SelectedTower.GetComponent <SpriteRenderer>().color = new Color(1f, 1f, 1f, 1f); TowerMenu.transform.Find("UpgradeButton").GetComponentInChildren <Text>().text = ""; TowerMenu.transform.Find("SellButton").GetComponentInChildren <Text>().text = ""; } //Κάνει εμφανες στο χρήστη οτι επίλέχτηκε ο πύργος SelectedTower = t; SelectedTower.GetComponent <SpriteRenderer>().color = new Color(1f, 0, 0, 1f); tlevel = SelectedTower.GetComponentInChildren <Tower>().Towerlevel; //Ορίζει μια int ανάλογα με το τύπο του πύργου switch (t.name) { case "Tower": ttype = 1; break; case "Slow Tower": ttype = 2; break; case "Buff Tower": ttype = 3; break; case "RoundHouse Tower": ttype = 4; break; case "Global Tower": ttype = 5; break; case "Canon Tower": ttype = 6; break; } //Προσδιορίζει τις αναβαθμίσεις των πύργων TowerUpgrades.setTowerUpgrades(ttype, tlevel); ToggleTowerMenu(); UpdateMenu(); }
public void Awake() { towerUpgrades = FindObjectOfType <TowerUpgrades>(); }