コード例 #1
0
    // if gameover is true
    //if space key pressed
    //spawn player
    //game over = false
    // hide title screen

    void Update()
    {
        if (gameOver)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                Instantiate(player, Vector3.zero, Quaternion.identity);
                gameOver = false;
                _uI_Manager.HideTitleScreen();
            }
        }
    }
コード例 #2
0
 private void Update()
 {
     if (gameOver == true)
     {
         _UiManager.ShowTitleScreen();
         if (Input.GetKeyDown(KeyCode.Space)) //Game start
         {
             Instantiate(player, Vector3.zero, Quaternion.identity);
             gameOver           = false;
             _SpawnManager.boss = false;
             _SpawnManager.StartCoroutine(_SpawnManager.SpawnEnemy());
             _SpawnManager.StartCoroutine(_SpawnManager.SpawnPowerUp());
             _UiManager.HideTitleScreen();
             _UiManager.actualScore    = 0;
             _UiManager.scoreText.text = "Score: " + _UiManager.actualScore;
             _UiManager.playText.SetActive(false);
         }
     }
 }