Example #1
0
        public void HandleCollision(Asteroid a, Player p)
        {
            // Make sure the asteroid is active
            if (a.isActive == false)
            {
                return;
            }

            // Make sure the player is active
            if (p.isActive == false || p.IsSpawnProtectionActive == true)
            {
                return;
            }

            // Let the player handle its collision with the asteroid
            p.HandleCollision(a);

            // Trigger an explosion particle effect
            explosionEffect.Trigger(a.Position);

            // Play a sound - (http://www.freesound.org/people/m_O_m/sounds/109073/)
            asteroid_hit.Play();

            // Handle the asteroid collision
            HandleAsteroidCollision(a);
        }