void beacon() { BeaconTurretBuff turretBuff = new BeaconTurretBuff(beaconID, 1f, beaconTurretFireRate.get(), beaconTurretRange.get(), beaconTurretDamage.get(), beaconTurretLaserDOT.get(), beaconTurretFireDOT.get()); BeaconMinionBuff minionBuff = new BeaconMinionBuff(beaconID, 3f, beaconMinionDamage.get(), beaconMinionMovespeed.get()); Collider[] cols = Physics.OverlapSphere(this.transform.position, range.get()); foreach (Collider col in cols) { if (col.tag.Equals(beaconTurretTag) && col.gameObject != this.gameObject) { if (col.GetComponent <Turret>().towerType != Turret.TowerType.Beacon) { turretBuff.copy().apply(col.transform); } } if (col.tag.Equals(beaconMinionTag) && col.gameObject != this.gameObject) { minionBuff.copy().apply(col.transform); Minion m = col.GetComponent <Minion>(); m.takeDamage(-beaconMinionHeal.get() / 100f * m.health.getMissing() / .5f, this.gameObject, true); } if (col.tag.Equals("Player") && isPlayer) { col.GetComponent <Damageable>().takeDamage(-beaconPlayerHeal.get() / 100f * col.GetComponent <Player>().health.getMissing() / .5f, this.gameObject, true); } } }
public void apply(Component target) { startTime = Time.time; turret = target.GetComponent <Turret>(); List <Buff> buffsToRemove = new List <Buff>(); foreach (Buff b in turret.buffs) { if (b is BeaconTurretBuff) { BeaconTurretBuff sb = (BeaconTurretBuff)b; if (this.id == sb.id) { buffsToRemove.Add(sb); } } } buffsToRemove.ForEach(buff => buff.finish()); turret.addBuff(this); }