Ejemplo n.º 1
0
    public void NewGame()
    {
        //Сбрасываются все накопленные предсмертные эффекты
        Damageable[] damageables = FindObjectsOfType <Damageable>();
        for (int i = 0; i < damageables.Length; i++)
        {
            damageables[i].ClearActions();
        }

        player.gameObject.SetActive(true);
        player.ResetPlayer();
        player.GetComponent <Damageable>().AddAction(DiePlayer);

        currentPlayerHealthPoints = maxPlayerHealthPoints;
        menu.UpdateHealthIcons(currentPlayerHealthPoints);
        menu.ResetScore();

        currentAsteroidsCountAtWave = startAsteroidsCount;
        activeAsteroids.Clear();
        objectsPool.ResetPools();
        InitializationPools();

        if (newWave != null)
        {
            StopCoroutine(newWave);
        }
        newWave = NewWave();
        StartCoroutine(newWave);
        DieUFO();

        gameStarted = true;
    }