public void UpgradeTower() { PlaceTower towerScript = activePlatform.GetComponent <PlaceTower>(); towerScript.UpgradeTower(); if (!towerScript.CanUpgradeTower()) { ActivePlatform = null; } }
// Use this for initialization void Start() { planet = GameObject.FindGameObjectWithTag("Player").GetComponent <Planet>(); btn = GetComponent <Button>(); btn.onClick.AddListener(PlaceWeapon); PlaceTower p = Weapon.transform.Find("PlaceModel").GetComponent <PlaceTower>(); p.cost = price; highlight = transform.Find("highlight").gameObject; }
public void BuildTowerOn(PlaceTower node) { if (PlayerStats.Money < towerToBuild.cost) { Debug.Log("Insufficient fund"); return; } PlayerStats.Money -= towerToBuild.cost; GameObject tower = (GameObject)Instantiate(towerToBuild.prefab, node.GetBuildPosition(), Quaternion.identity); node.tower = tower; Debug.Log("Tower has been built, the remaining money is :" + PlayerStats.Money); }
public void BuildTower(PlaceTower node) { if (PlayerMoney.Money < towerToBuild.cost) { Debug.Log("u broke"); return; } PlayerMoney.Money -= towerToBuild.cost; GameObject tower = (GameObject)Instantiate(towerToBuild.prefab, node.transform.position, Quaternion.identity); node.tower = tower; Debug.Log("Tower build, money: " + PlayerMoney.Money); }
// Use this for initialization void Start() { numberOfUnitTypes = 2; castlePlacer = transform.parent.GetComponent<PlaceCastle>(); roadPlacer = transform.parent.GetComponent<PlaceRoad>(); unitCreator = transform.parent.GetComponent<CreateUnit>(); towerPlacer = transform.parent.GetComponent<PlaceTower>(); playerManager = transform.parent.GetComponent<PlayerManager>(); buttonWidth = Screen.width / 4; buttonHeight = 30; castleX = 0; roadsX = castleX + buttonWidth; unitX = roadsX + buttonWidth; towerX = unitX + buttonWidth; topLayer = Screen.height - buttonHeight; isManagingCastle = false; isPlacingCastle = false; isManagingRoad = false; isPlacingRoad = false; isSelectingRoad = false; isManagingUnit = false; isCreatingUnit = false; isMovingUnit = false; isManagingTower = false; isPlacingTower = false; }
public void DestroyTower() { this.placeTower.DestroyTower(); this.placeTower = null; }
public void UpgradeTower() { this.placeTower.UpgradeTower(); this.placeTower = null; }
public void SetPlaceTower(PlaceTower placeObj) { placeTower = placeObj; }
// Start is called before the first frame update private void Start() { playerController = GameObject.Find("Player Controller").GetComponent <PlaceTower>(); }