Пример #1
0
    //Remove everything from screen (READY SCREEN)
    public void clearScreen()
    {
        helpScreen.SetActive(false);
        CancelInvoke();                                          //To not spawn UFO

        player.GetComponent <PlayerCollision>().cancelRespawn(); //Not respawn player accidentally
        player.SetActive(false);
        BigUFO.SetActive(false);
        SmallUFO.SetActive(false);
        BigAsteroids.inactiveAll();
        MedAsteroids.inactiveAll();
        SmallAsteroids.inactiveAll();
    }
Пример #2
0
    //Where the asteroids and UFO plays in Main Menu
    public void startDemo()
    {
        player.SetActive(false);
        BigUFO.SetActive(false);
        SmallUFO.SetActive(false);

        spawnAsteroids(); //Spawn 4 asteroids

        MedAsteroids.inactiveAll();
        SmallAsteroids.inactiveAll();

        Invoke("spawnUFO", 15f); //Spawn UFO each 15 seconds
    }
Пример #3
0
    //Gameplay screen
    public void startGameplay()
    {
        player.SetActive(true);
        player.transform.position = new Vector3(0f, 0f); //Set player to the center of the screen

        BigUFO.SetActive(false);
        SmallUFO.SetActive(false);

        spawnAsteroids(); //Spawn 4 asteroids at begining

        MedAsteroids.inactiveAll();
        SmallAsteroids.inactiveAll();

        Invoke("spawnUFO", 15f);
    }
Пример #4
0
 void FixedUpdate()
 {
     //If it's in gameplay
     if (GameStates.actualGameState == GameState.Gameplay)
     {
         //If do not have any asteroids
         if (!BigAsteroids.haveActives() &&
             !MedAsteroids.haveActives() &&
             !SmallAsteroids.haveActives() &&
             !changingLevel)
         {
             gameplayManager.stopAudio(); //Stop audio background
             changingLevel = true;        //Changing level
             Invoke("nextLevel", 2f);     //Change level in 2 seconds
         }
     }
 }
Пример #5
0
    //Define next level
    void nextLevel()
    {
        GameStates.level++;

        gameplayManager.startAudioAgain();                //Play audio from beginning

        int lengthNecessary = 4 + (2 * GameStates.level); //How many Asteroids?

        //If it's necessary to add more Asteroids to Pooling System
        if (BigAsteroids.getLength() < lengthNecessary)
        {
            BigAsteroids.addToList(2);   // 2 Big
            MedAsteroids.addToList(4);   // 4 Medium
            SmallAsteroids.addToList(8); // 8 Small
        }

        spawnAsteroids();      // Spawn

        changingLevel = false; // Ok, changed level
    }