Exemplo n.º 1
0
        public void OnRestartBtnClick()
        {
            var showable = GameOverScreen.GetComponent <ShowableView>();

            showable.OnHide += OnHideForRestart;
            showable.Hide();
        }
Exemplo n.º 2
0
 void ShowGameOverScreen(GameOverType type)
 {
     IsAlive = false;
     GameOverScreen.gameObject.SetActive(true);
     GameOverScreen.GetComponent <Animator>().SetTrigger("Appear");
     GameOverScreen.SetSprite(type);
     timer.Stop();
 }
Exemplo n.º 3
0
    void Update()
    {
        alive = go.GetComponent <GameOverScreen>().alive;
        float scoreUpdate = 0;

        //Tick multiplier  (Multiply by multipliers)
        multiplier = 1f;

        foreach (Upgrades.Upgrade id in _upgrades.CurrentUpgrades())
        {
            if (id.IsMyName("multiplier"))
            {
                multiplier += id.Level();
            }
        }


        foreach (MulStruct mul in new Dictionary <int, MulStruct>(_multis).Values)
        {
            mul._time -= Time.deltaTime;
            if (mul._time <= 0)
            {
                _multis.Remove(mul._location);
            }
            else
            {
                multiplier *= mul._mult;
            }
        }

        if (_foodFactor > 100)
        {
            butt.SetActive(true);
            FindObjectOfType <AudioManager>().play("EGM");
        }

        //Update score by adding to old score
        if (alive)
        {
            scoreUpdate += _mv.GetCurrentSpeed() * Time.deltaTime * multiplier;
            score       += Mathf.RoundToInt(scoreUpdate);
        }

        //Update highscore
        int oldHighScore = PlayerPrefs.GetInt("highScore");

        if (score > oldHighScore)
        {
            PlayerPrefs.SetInt("highScore", score);
            if (!TheBoolThatTellsIfTheAnimationForANewHighScoreHasBeenPlayed)
            {
                anim.SetTrigger("high");
                TheBoolThatTellsIfTheAnimationForANewHighScoreHasBeenPlayed = true;
            }
        }
        highScore.text = "High Score: " + PlayerPrefs.GetInt("highScore");
        updateText();
    }
Exemplo n.º 4
0
        public void OnResurrectBtnClick()
        {
            PlayerState playerState = PlayerStateStorage.Get();

            --playerState.AvailableResurrectionsCount;
            PlayerStateStorage.Save(playerState);
            player.IsHealthFreezed = false;
            player.IsScoreFreezed  = false;
            player.Resurrect();
            GameOverScreen.GetComponent <ShowableView>().Hide();
        }
Exemplo n.º 5
0
 public void resume()
 {
     Time.timeScale = 1;
     go.GetComponent <GameOverScreen>().hidePause();
 }
Exemplo n.º 6
0
 public void OnExitBtnClick()
 {
     Game.UnloadLevel();
     GameOverScreen.GetComponent <ShowableView>().Hide();
     MainScreen.GetComponent <ShowableView>().Show();
 }