/// <summary> /// When a mouse button down is register on the tile, the base turret is created and a reference to the /// instantiated tower is stored as this space's current tower. /// <para>Then each desired ability is added to this current tower.</para> /// </summary> private void OnMouseDown() { // Check if the mouse was clicked over a UI element if (!EventSystem.current.IsPointerOverGameObject()) { if (myTurret != null) { Debug.Log("Cant Build Here, already have a tower"); // TODO // Activate this tower and display it on the UI return; } else { myTurret = Instantiate(baseTurret, transform.position, transform.rotation); myTurret.transform.parent = transform; PolyTower tower = myTurret.GetComponent <PolyTower>(); foreach (TowerAbility ta in towerToBuild.myAbilities) { tower.myAbilities.Add(ta); foreach (Effect e in ta.GetEffects()) { if (e is TowerEffect) { TowerEffect temp = (TowerEffect)e; temp.AlterTower(tower); } } } TowerConstructed.Raise(); } } }
public override void AlterTower(PolyTower ts) { ts.range *= rangeMultiplier; }
abstract public void AlterTower(PolyTower ts); // used to change the range of the tower etc