示例#1
0
    private void Start()
    {
        player.OnPlayerDestroy += OnPlayerDestroy;

        scoreTextMeshPro.text = score.ToString();

        activeAsteroidsCount = asteroidSpawner.SpawnAsteroids(OnAsteroidDestroy);
    }
 // Check whether Asteroids should be spawned
 private void Update()
 {
     if (GameManager.SpawnFlag == true && DateTime.Now > GameManager.SpawnTime && GameManager.IsGameStarted)
     {
         GameManager.SpawnFlag = false;
         aSpawn.SpawnAsteroids();
     }
 }
示例#3
0
    public void StartGame()
    {
        // 1. Destroy Asteroids
        var asteroids = gameObjectCounter.gameObjects.FindAll(obj => obj != null && obj.GetComponent <Asteroid>() != null);

        asteroids.ForEach(asteroid => Destroy(asteroid));

        // 2. Spawn Ship Controller
        var playerShip = Instantiate(playerShipPrefab, Camera.main.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0.0f)) + new Vector3(0.0f, 0.0f, 10.0f), Quaternion.identity);

        // 3. Spawn Asteroids
        asteroidSpawner.StartCoroutine(asteroidSpawner.SpawnAsteroids());

        // Begin Checking Game State here
        StartCoroutine(CheckForGameOver());
        StartCoroutine(CheckForWinState());
    }
示例#4
0
 public void StartGame()
 {
     asteroidSpawner.SpawnAsteroids();
 }