コード例 #1
0
    void OnCollisionEnter2D(Collision2D asteroid)
    {
        // Make sure it's an asteroid and not a bullet
        if (asteroid.gameObject.name.StartsWith("Asteroid"))
        {
            // Set the asteroid to false so it can be respawned
            spawner.OnAsteroidHit(asteroid.gameObject);

            // "Kill" the user
            Die();
        }
    }