void OnCollisionStay2D(Collision2D collision) { PlatformerController2D controller = collision.gameObject.GetComponent <PlatformerController2D>(); if (controller != null) { controller.TakeDamage(); } }
void OnTriggerStay2D(Collider2D other) { PlatformerController2D pController = other.gameObject.GetComponent <PlatformerController2D>(); if (pController != null) { pController.TakeDamage(); return; } }