public static void PurchaseTower(TOWER_TYPE type, TOWER_POSITION pos) { if (GameManager.isBreakInProgress()) { switch (pos) { case TOWER_POSITION.NORTHEAST: instance.BuyTower(instance.bulletTowerCost, instance.FindTowerByPosition(pos), type); break; case TOWER_POSITION.NORTHWEST: instance.BuyTower(instance.bulletTowerCost, instance.FindTowerByPosition(pos), type); break; case TOWER_POSITION.SOUTHEAST: instance.BuyTower(instance.bulletTowerCost, instance.FindTowerByPosition(pos), type); break; case TOWER_POSITION.SOUTHWEST: instance.BuyTower(instance.bulletTowerCost, instance.FindTowerByPosition(pos), type); break; default: break; } } }
private TowerData GetActiveTower(TOWER_POSITION pos) { TowerData targetTower; targetTower.pos = TOWER_POSITION.NULL; targetTower.bulletTower = null; foreach (TowerData data in towerDatas) { if (pos == data.pos) { targetTower = data; } } return(targetTower); }
private TowerData FindTowerByPosition(TOWER_POSITION pos) { TowerData output; output.bulletTower = null; output.pos = TOWER_POSITION.NULL; foreach (TowerData data in towerDatas) { if (data.pos == pos) { output = data; break; } } return(output); }
private void DeActivateTower(TOWER_POSITION pos) { TowerData targetTower; targetTower.pos = TOWER_POSITION.NULL; targetTower.bulletTower = null; foreach (TowerData data in towerDatas) { if (pos == data.pos) { targetTower = data; } } if (targetTower.pos != TOWER_POSITION.NULL) { targetTower.bulletTower.gameObject.SetActive(false); } }
private void ActivateTower(TOWER_POSITION pos, TOWER_TYPE type) { TowerData targetTower; targetTower.pos = TOWER_POSITION.NULL; targetTower.bulletTower = null; foreach (TowerData data in towerDatas) { if (pos == data.pos) { targetTower = data; } } if (targetTower.pos != TOWER_POSITION.NULL) { if (type == TOWER_TYPE.BULLET_TOWER) { targetTower.bulletTower.gameObject.SetActive(true); } } }