private void SetStateGameOver()
 {
     GameStatCarrier.isFirstShotPlayed = false;
     currentState = PlayState.GAMEOVER;
     loader.LoadScene(2);
     EventHub.PlayStateUpdate.Invoke(currentState);
 }
Esempio n. 2
0
    public void Load()
    {
        PlayerData data = SaveState.LoadPlayer();

        if (data != null)
        {
            Debug.Log("loading player data...");

            maxHealth     = data.maxHealth;
            currentHealth = data.currentHealth;
            if (healthBar != null)
            {
                healthBar.SetMaxHealth(maxHealth);
                healthBar.SetHealth(currentHealth);
            }

            currentScene = data.level;

            LoadLevel.LoadScene(data.level);

            Vector3 position;
            position.x = data.position[0];
            position.y = data.position[1];
            position.z = data.position[2];
            transform.parent.position = position;

            loaded = true;
        }
    }
Esempio n. 3
0
 /// <summary>
 /// Начать игру
 /// </summary>
 public void StartLevel()
 {
     if (LoadLevel != null)
     {
         LoadLevel.LoadScene(1);
     }
 }
Esempio n. 4
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         LoadLevel.LoadScene(sceneToLoad);
     }
 }
    public void LoadMainMenu()
    {
        Time.timeScale = 1f;

        Debug.Log("Loading menu...");
        LoadLevel.LoadScene(0);
        //SceneManager.LoadScene(0);
    }
Esempio n. 6
0
 public void CheckRespawn()
 {
     if (Time.time >= respawnTimeStart - respawnTime && respawn)
     {
         Debug.Log("Respawning player...");
         LoadLevel.LoadScene(iLevelToRespawn);
         SearchSpawnPoint();
         Instantiate(player, respawnPoint);
         respawn = false;
     }
 }
    public void PlayerDead()
    {
        // se la scena non e' l'ultima
        if (SceneManager.GetActiveScene().buildIndex < 6)
        {
            _player.transform.position = new Vector3(0, -1000, 0);

            audioController.PlayPlayerDeadSound();

            ShowDeathScreen();

            GetComponent <PauseMenu>().PlayerIsDead();
        } // altrimenti carica i credits
        else
        {
            LoadLevel.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
        }
    }
Esempio n. 8
0
 public void OnPressStart()
 {
     GameStatCarrier.isContinuedSession = true;
     loader.LoadScene(1);
 }
Esempio n. 9
0
 /// <summary>
 /// Конец уровня
 /// </summary>
 public void EndLevel()
 {
     UserData.score += score;
     UserData.SaveUserDataScore();
     loadLevel.LoadScene(0);
 }
 public void BackToMenu()
 {
     LoadLevel.LoadScene(0);
 }
 public void OnPressNewGame()
 {
     loader.LoadScene(1);
 }
Esempio n. 12
0
 public void ChoseLevel(int levelIndex)
 {
     LoadLevel.LoadScene(levelIndex);
 }
 public void StartLevelLoad(int levelIndex)
 {
     LoadLevel.LoadScene(levelIndex);
 }
 public void StartLevelLoad(String levelName)
 {
     LoadLevel.LoadScene(SceneManager.GetSceneByName(levelName).buildIndex);
 }
Esempio n. 15
0
 void InitLoadNextLEvel()
 {
     Debug.Log("Loading");
     LoadLevel.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
 }
 public void NewGame()
 {
     LoadLevel.LoadScene(3);
 }