예제 #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "AsteroidCatch" || other.tag == "StellarBody")
     {
         if (!dead)
         {
             controller.SpawnAsteroid(GetComponent <AsteroidModel>());
             dead = true;
         }
         Destroy(gameObject);
     }
 }
예제 #2
0
    private void SpawnParentAsteroid(int index)
    {
        AsteroidController asteroid = AsteroidController.SpawnAsteroid();
        Vector3            spawnLocation;

        do
        {
            spawnLocation = ScreenBounds.RandomLocationOnScreen();
        } while ((spawnLocation - PlayerShipController.POSITION).magnitude < MIN_DISTANCE_AST_FROM_SHIP);
        asteroid.transform.position = spawnLocation;
        asteroid.transform.rotation = Random.rotation;
        asteroid.asteroidSize       = currentLevel.initialAsteroidSize;
        asteroid.gameObject.name    = "Asteroid_" + index.ToString("00");
    }