Ejemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D collider)
 {
     Debug.Log("Trigger " + collider.gameObject.name + ";" + collider.gameObject.tag);
     if (collider.gameObject.tag != "Projectile" && playerDead != true)
     {
         if (PlayerPrefs.GetInt("sound") == 1)
         {
             GameObject.Find("Sound").GetComponent <AudioSource>().PlayOneShot(deathSound);
         }
         DeathScreenCanvas.SetActive(true);
         JumpButton.SetActive(false);
         ScoreText.SetActive(false);
         SlideButton.SetActive(false);
         PauseButton.SetActive(false);
         Time.timeScale = 0f;
         playerDead     = true;
         Score.text    += ScoreScript.scoreValue;
         Scoreboard.AddHighscoreEntry(Convert.ToInt32(ScoreScript.scoreValue));
     }
 }
Ejemplo n.º 2
0
    public void Update()
    {
        runner = GameObject.Find("Runner");
        Vector2 worldpos = runner.transform.position;

        if (worldpos.y < -15 && state == false && playerDead != true)
        {
            Debug.Log(worldpos);
            DeathScreenCanvas.SetActive(true);
            JumpButton.SetActive(false);
            ScoreText.SetActive(false);
            SlideButton.SetActive(false);
            PauseButton.SetActive(false);
            Time.timeScale = 0f;
            playerDead     = true;
            Score.text    += ScoreScript.scoreValue;
            Scoreboard.AddHighscoreEntry(Convert.ToInt32(ScoreScript.scoreValue));
            state = true;
        }
    }