Beispiel #1
0
 private void GameIsOver()
 {
     GameObject.FindGameObjectWithTag("Controller").GetComponent <UserInterfaceButtons>().Playing = false;
     GameOverScr.SetActive(true);
     GameOverSource.PlayOneShot(GameOverSFX);
     GameOver();
     Debug.Log("Game Over!");
     GameObject.FindGameObjectWithTag("Controller").GetComponent <UserInterfaceButtons>().SetAnimationIdle();
     GameObject.FindGameObjectWithTag("SFXController").GetComponent <ModelSoundManager>().StopLoopSound();
 }
Beispiel #2
0
 private bool CheckIfGameOver(GameOverSource source, int food)
 {
     if (food <= 0)
     {
         SoundManager.instance.PlaySingle(gameOverSound);
         SoundManager.instance.musicSource.Stop();
         enabled = false;
         GameManager.instance.GameOver(source);
         return(true);
     }
     return(false);
 }
Beispiel #3
0
 public void GameOver(GameOverSource source)
 {
     if (source == GameOverSource.MOVE)
     {
         levelText.text = "After " + level + " days, \n\nyou starved.";
     }
     else if (source == GameOverSource.ENEMY)
     {
         levelText.text = "After " + level + " days, \n\nyou were eaten alive.";
     }
     levelImage.SetActive(true);
     enabled = false;
     Invoke("LoadTitle", 6f);
 }
Beispiel #4
0
    public static void SetGameOver(GameObject caller, GameOverSource source)
    {
        GameObject.Find("FlagManager").GetComponent <FlagManager>().gameIsOver = true;

        Text promptText = GameObject.Find("Prompt").GetComponent <Text>();

        switch (source)
        {
        case GameOverSource.COLLISION:
            promptText.text = "You collided!";
            break;

        case GameOverSource.SWERVE:
            promptText.text = caller.name + " swerved!";
            break;
        }
    }
Beispiel #5
0
 public void PlayGameOver()
 {
     GameOverSource.Play();
 }