void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "Enemy") { col.transform.root.BroadcastMessage("HitBy", GetComponentInParent <CasterReference>().GetCaster()); col.gameObject.BroadcastMessage("TakeDamage", spellStats.GetSpellDamage()); Destroy(gameObject); } }
//private bool enableHeal = false; private void Awake() { spellStats = GetComponent <SpellStats>(); collider2D = GetComponent <CircleCollider2D>(); totalHealingAmount = spellStats.GetSpellDamage(); healingTurretRange = spellStats.GetRange(); GetComponent <CircleCollider2D>().radius = healingTurretRange; amountPerHeal = totalHealingAmount / (effectTime / timeBetweenHeals); }
/* * Eventually make this a coroutine that waits for a response from the turret that it has finished it's death. * */ public void BlowTurretsUpForDamage(Queue <GameObject> turrets) { while (turrets.Count != 0) { GameObject turret = turrets.Dequeue(); Vector3 turretlocationRelativeToPlayer = turret.transform.localPosition; GameObject explosion = Instantiate(turretExplosions, turretlocationRelativeToPlayer, Quaternion.identity, transform); explosion.GetComponent <TurretExplosionDamageSender>().BlowUpTurrets(spellStats.GetSpellDamage(), spellStats.GetRange()); Destroy(turret); } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { return; } if (other.tag == "Enemy") { gameObject.GetComponent <SpriteRenderer>().enabled = false; Instantiate(enemyExplosion, other.transform.position, other.transform.rotation); GameObject mineExplosion = Instantiate(explosion, transform.position, transform.rotation, transform); mineExplosion.GetComponent <TurretExplosionDamageSender>().BlowUpTurrets(spellStats.GetSpellDamage(), spellStats.GetRange()); } }