public void AddTower(string towerTypeAsString) { towerType type = (towerType)Enum.Parse(typeof(towerType), towerTypeAsString, true); if (TowerManager.Instance.GetTowerPrice(type) <= GameManager.Instance.gold) { GameManager.Instance.gold -= TowerManager.Instance.GetTowerPrice(type); TowerManager.Instance.CreateNewTower(towerSlotToAddTowerTo, type); gameObject.SetActive(false); } }
public Tower(Vector2 newLocation, int type) { location = newLocation; switch (type) { case (int)towerType.regular: thisType = towerType.regular; rof = 1; range = 100; break; case (int)towerType.ice: thisType = towerType.ice; rof = 3; range = 75; break; } }
public Tower(Vector2 newLocation, int type) { location = newLocation; switch (type) { case (int)towerType.regular: thisType = towerType.regular; rof = 1; range = 100; break; case (int)towerType.ice: thisType = towerType.ice; rof = 3; range = 75; break; } }
public void CreateNewTower(GameObject slotToFill, towerType towerType) { switch (towerType) { case towerType.Stone: Instantiate(stoneTowerPrefab, slotToFill.transform.position, Quaternion.identity); slotToFill.gameObject.SetActive(false); break; case towerType.Fire: Instantiate(fireTowerPrefab, slotToFill.transform.position, Quaternion.identity); slotToFill.gameObject.SetActive(false); break; case towerType.Ice: Instantiate(iceTowerPrefab, slotToFill.transform.position, Quaternion.identity); slotToFill.gameObject.SetActive(false); break; } }
//Instantiate a Tower above the Floor public bool createTower(towerType t) { if(!isEmpty()) return false; has=terrain.tower; if (t == towerType.tower1) { GameObject towerObject = (GameObject)Instantiate( tower1Prefab, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity ); currentObject = towerObject; towerObject.tag = "Tower"; emitMineralSprite ("-", GameController.tower1Cost.ToString()); } else if (t == towerType.tower2) { GameObject towerObject = (GameObject)Instantiate( tower2Prefab, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity ); currentObject = towerObject; towerObject.tag = "Tower"; emitMineralSprite ("-", GameController.tower2Cost.ToString()); } else if (t == towerType.tower3) { GameObject towerObject = (GameObject)Instantiate( tower3Prefab, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity ); currentObject = towerObject; towerObject.tag = "Tower"; emitMineralSprite ("-", GameController.tower3Cost.ToString()); } emitParticles(1); return true; }
public void setTowerType(towerType t) { currentType = t; }
public int GetTowerPrice(towerType towerType) { return((from towerCost in TowerCosts where towerCost.TowerType == towerType select towerCost.Cost).FirstOrDefault()); }
private void setTowerType(towerType t) { if(t==towerType.tower1) { range=4; damage=25; reload=60; strategy=1; showRange(); } else if(t==towerType.tower2) { range=2; damage=50; reload=100; strategy=2; showRange(); } else { range=6; damage=0; reload=40; strategy=1; showRange(); } }