void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.tag == "Zombie") { thisZombieMechanism = col.gameObject.GetComponent <ZombieMechanism>(); if (disableInstantBlow == false) { exploded = true; damage = 30; } else { ActivateExplode(); FreezePosition(); } thisZombieMechanism.thisZombieIsBeingShot(damage); Instantiate(bloodParticle, col.gameObject.transform.position, col.gameObject.transform.rotation); } if (col.gameObject.tag == "Decoration" || col.gameObject.tag == "Walls") { if (disableInstantBlow == false) { exploded = true; damage = 30; } else { FreezePosition(); } } }
void OnTriggerStay2D(Collider2D col) { if (col.gameObject.tag == "Survivor") { Setups.survivor.Damage(damage); } if (col.gameObject.tag == "Zombie") { zombieMechanismScript = col.gameObject.GetComponent <ZombieMechanism>(); zombieMechanismScript.thisZombieIsBeingShot(damage); } }
// Use this for initialization void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.tag == "Zombie") { zombieMechanismScript = col.gameObject.GetComponent <ZombieMechanism>(); zombieMechanismScript.thisZombieIsBeingShot(Setups.survivor.getSurvivorWeapon().getPower()); Instantiate(bloodParticle, col.gameObject.transform.position, col.gameObject.transform.rotation); Destroy(gameObject); } if (col.gameObject.tag == "Decoration" || col.gameObject.tag == "Walls") { Destroy(gameObject); } }