private void OnCollisionEnter(Collision collision) { GameObject collider = collision.gameObject; EnemyUI enemy = collider.GetComponent <EnemyUI>(); PortalUI portal = collider.GetComponent <PortalUI>(); if (enemy != null) { playerCollisionNotifier.OnCollision(GetPlayerData(), enemy.GetEnemyData()); } if (portal != null) { playerTeleportationNotifier.OnTeleportation(portal.GetPortalData()); } }