virtual public void OnCollisionEnter2D(Collision2D collisionObject) { if (collisionObject.gameObject.tag == "projectile") { cam_shake.shakeAmount = .05f; cam_shake.addDuration(.3f); Destroy(gameObject); CircleCollider2D explosion_instance = Instantiate(explosion, collisionObject.transform.position, collisionObject.transform.rotation) as CircleCollider2D; Destroy(collisionObject.gameObject); anal_glitch.camEffect(analStrength); } if (collisionObject.gameObject.tag == "explosion" || collisionObject.gameObject.tag == "smallExplosion") { Destroy(gameObject); Destroy(collisionObject.gameObject, .1f); } if (collisionObject.gameObject.tag == "smallProjectile") { cam_shake.shakeAmount = .025f; cam_shake.addDuration(.2f); Destroy(gameObject); CircleCollider2D explosion_instance = Instantiate(smallExplosion, collisionObject.transform.position, collisionObject.transform.rotation) as CircleCollider2D; Destroy(collisionObject.gameObject); anal_glitch.camEffect(analStrength); } }
virtual public void OnCollisionEnter2D(Collision2D collisionObject) { if (collisionObject.gameObject.tag == "projectile" || collisionObject.gameObject.tag == "explosion") { cam_shake.shakeAmount = .25f; cam_shake.addDuration(.60f); curr_health -= 25f; float health_scale = curr_health / max_health; SetHealthBar(health_scale); Destroy(collisionObject.gameObject); anal_glitch.camEffect(analStrength); audios.Play(); } if (collisionObject.gameObject.tag == "smallProjectile" || collisionObject.gameObject.tag == "smallExplosion") { cam_shake.shakeAmount = .15f; cam_shake.addDuration(.4f); curr_health -= 10f; float health_scale = curr_health / max_health; SetHealthBar(health_scale); Destroy(collisionObject.gameObject); anal_glitch.camEffect(analStrength); audios.Play(); } }