Пример #1
0
 void DontFuel()//Закончилось топливо
 {
     state = State.Dead;
     audioSource.Stop();
     audioSource.PlayOneShot(loseSound);
     deathMenu.ToggleEndMenu();
 }
Пример #2
0
 private void EndGame()
 {
     isAlive = false;
     pauseButton.SetActive(false);
     AdManager.AdInstance.ShowAd();
     deathMenu.ToggleEndMenu(score);
 }
Пример #3
0
 public void PauseGame()
 {
     if (!isPaused)
     {
         deathMenu.ToggleEndMenu(score);
         isPaused = true;
     }
     else
     {
         deathMenu.UnToggleEndMenu();
         isPaused = false;
     }
 }
Пример #4
0
 public void OnDeath()
 {
     isDeath = true;
     PlayerPrefs.SetFloat("Coin Score", CoinScore);
     deathMenu.ToggleEndMenu(CoinScore);
     ScoreforCoin.CoinScore = 0;
 }
Пример #5
0
 public void OnDeath()
 {
     isDeath = true;
     PlayerPrefs.SetFloat("Highscore", score);
     deathMenu.ToggleEndMenu(score);
     Score.score = 0;
 }
Пример #6
0
 // Player has died
 void OnGameOver()
 {
     GroundTrans.doSpawn = false;
     Scrolling.gameOver  = true;
     isGameOver          = true;
     deathMenu.ToggleEndMenu(score);  //show the death button when the player died
 }
Пример #7
0
    public void OnDeath()
    {
        isDead = true;


        deathMenu.ToggleEndMenu(score);
    }
 public void OnDeath()
 {
     isDead = true;
     if (PlayerPrefs.GetFloat("Highscore") < score)
     {
         PlayerPrefs.SetFloat("Highscore", score);
     }
     deathMenu.ToggleEndMenu(score);
 }
Пример #9
0
    //private void OnCollisionEnter(Collision collision)
    //{
    //    if (collision.gameObject.tag == "Box" || collision.gameObject.tag == "FastBox")
    //    {
    //        Debug.Log("HIIITTT");
    //    }
    //}

    IEnumerator Wait()
    {
        //yield return new WaitForSeconds(2f);
        playerAnimation.CrossFade("Dying");
        yield return(new WaitForSeconds(1.5f));

        playerAnimation.Stop();
        deathMenu.ToggleEndMenu((int)score);
    }
Пример #10
0
 public void OnDeath(bool win)
 {
     isDead = true;
     if (PlayerPrefs.GetFloat("Highscore") < score)
     {
         PlayerPrefs.SetFloat("Highscore", score); // Set the highest score into Registry
     }
     deathMenu.ToggleEndMenu(score, win);
 }
Пример #11
0
 void Die()
 {
     //Debug.Log("Call Die()....");
     isDead = true;
     deathMenu.ToggleEndMenu(health);
     fixedJoystick.ToggleEndMenu();
     jumpBtn.ToggleEndMenu();
     fightBtn.ToggleEndMenu();
 }
Пример #12
0
 public void OnDeath()
 {
     iSDead = true;
     if ((int)PlayerPrefs.GetFloat("Highscore") < score)
     {
         NHS.text = "NEW HIGH SCORE!!";
         PlayerPrefs.SetFloat("Highscore", score);
     }
     deathMenu.ToggleEndMenu(score);
 }
Пример #13
0
    public void Ondeath()
    {
        isdead = true;
        if (PlayerPrefs.GetFloat("Hig") < score)
        {
            PlayerPrefs.SetFloat("Hig", score);
        }

        deathmenu.ToggleEndMenu(score);
    }
Пример #14
0
 public void OnDeath(){
     isDead = true;
     if(PlayerPrefs.GetFloat("HighScore") < score){
         PlayerPrefs.SetFloat("HighScore", score);
     }
     
     deathMenu.ToggleEndMenu(score);
     int coinNumber = GetComponent<PlayerMotor>().coinCounter;
     PlayerPrefs.SetInt("CoinsCount", (PlayerPrefs.GetInt("CoinsCount") + coinNumber));//------ Adding the number of coins to the already stored number of coins.
 }
Пример #15
0
 public void OnDeath()
 {
     isDead = true;
     if (PlayerPrefs.GetFloat("Highscore") < score)
     {
         PlayerPrefs.SetFloat("Highscore", score);            //Saving the score in the registery regedit(software,defaultcompany)
     }
     //PlayerPrefs.GetInt ("Highscore");
     deathMenu.ToggleEndMenu(score);
 }
Пример #16
0
 public void OnDeath()
 {
     isDead = true;
     if (PlayerPrefs.GetFloat("Highscore") < score)
     {
         PlayerPrefs.SetFloat("Highscore", score);
     }
     scoreObject.SetActive(false);
     deathMenu.ToggleEndMenu(score);
 }
Пример #17
0
    // public GameObject completeLevelUI;

    // complete level - we are not completing levels because it is endless sliding
    //public void CompleteLevel()
    //{
    //    Debug.Log("Level Won");
    //    completeLevelUI.SetActive(true);
    //}

    // end game function
    public void EndGame()
    {
        if (gameHasEnded == false)
        {
            gameHasEnded = true;


            //need to set score on death
            deathMenu?.ToggleEndMenu(0f);
        }
    }
Пример #18
0
    private void Death()
    {
        m_isDead = true;
        if (PlayerPrefs.GetInt("Highscore") < m_numOfCollisionWithCoin)
        {
            Debug.Log("score2: " + PlayerPrefs.GetInt("Highscore"));
            PlayerPrefs.SetInt("Highscore", m_numOfCollisionWithCoin);
        }

        m_deathMenu.ToggleEndMenu(m_numOfCollisionWithCoin);
    }
Пример #19
0
 public void OnDeath()
 {
     isDead = true;
     Debug.Log(PlayerPrefs.GetFloat("HighScore"));
     Debug.Log(score > PlayerPrefs.GetFloat("HighScore"));
     if (score > PlayerPrefs.GetFloat("HighScore"))
     {
         PlayerPrefs.SetFloat("HighScore", score);
     }
     deathMenu.ToggleEndMenu(score);
 }
Пример #20
0
 public void OnDeath()
 {
     /*isDead = true;
      * if (PlayerPrefs.GetFloat("Highscore") < score)
      * {
      *  PlayerPrefs.SetFloat("Highscore", score);
      *  deathMenu.newBestText.enabled = true;
      * }
      * coins += coin;
      * PlayerPrefs.SetInt("Coins", coins);*/
     deathMenu.ToggleEndMenu(score, coin);
 }
Пример #21
0
    public void OnDeath()
    {
        m_isDead = true;

        //if a new highscore is set update it
        if (PlayerPrefs.GetFloat("Highscore") < m_score)
        {
            PlayerPrefs.SetFloat("Highscore", m_score);
        }

        deathMenu.ToggleEndMenu(m_score); // show death menu
    }
Пример #22
0
    void OnCollisionEnter(Collision col)
    {
        if (col.gameObject.tag == "Obstacle")
        {
            gameObject.SetActive(false);
            isDead = true;

            deathMenu.ToggleEndMenu();
            pauseScript.buttonToggleOff();
            scoreScript.TurnScoreOff();
        }
    }
Пример #23
0
 public void OnDeath()
 {
     isDead = true;
     if (PlayerPrefs.GetFloat("Highscore") < score)
     {
         PlayerPrefs.SetFloat("Highscore", score);
     }
     Debug.Log("d");
     FindObjectOfType <WhiteScreen>().Kill();
     Debug.Log("d");
     deathMenu.ToggleEndMenu(score);
 }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetButtonDown("up") || Input.GetButtonDown("down") || Input.GetButtonDown("left") || Input.GetButtonDown("right"))
        {
            move = true;
        }

        if (move)
        {
            if (!isDead)
            {
                //*thePlayer's Z position will always be greater then the camera's Z position
                if (gameObject.transform.position.z < thePlayer.transform.position.z - 1)
                {
                    //lerps the camera towards the player
                    shouldPos = Vector3.Lerp(gameObject.transform.position, thePlayer.transform.position, Time.deltaTime);
                    gameObject.transform.position = new Vector3(shouldPos.x, 1, shouldPos.z);
                }
                else
                {
                    //slowly moves the camera forward until player is a certain amount pass the camera's Z position
                    gameObject.transform.position += Vector3.forward * (Time.deltaTime * speed);
                    gameObject.transform.position  = new Vector3(Mathf.Lerp(gameObject.transform.position.x, thePlayer.transform.position.x, Time.deltaTime), 1, gameObject.transform.position.z);
                }
                if (gameObject.transform.position.x <= -1)
                {
                    gameObject.transform.position = new Vector3(Mathf.Lerp(gameObject.transform.position.x, -1, Time.deltaTime), 1, gameObject.transform.position.z);
                }
                if (gameObject.transform.position.x >= 1)
                {
                    gameObject.transform.position = new Vector3(Mathf.Lerp(gameObject.transform.position.x, 1, Time.deltaTime), 1, gameObject.transform.position.z);
                }
            }
            if (gameObject.transform.position.z > thePlayer.transform.position.z + 5)
            {
                //sets isDead to true and snaps camera to the player's position
                isDead = true;
                thePlayer.GetComponent <Bounce>().isDead = true;
                thePlayer.GetComponent <AnimationController>().isDead = true;
                shouldPos = Vector3.Lerp(gameObject.transform.position, thePlayer.transform.position, Time.deltaTime);
                gameObject.transform.position = new Vector3(shouldPos.x, 1, shouldPos.z - 4);
                deathMenu.ToggleEndMenu();    //calls the death menu
                gameMenu.ToggleOffGameMenu(); //turns off game menu icons
            }
        }
        //this will snap the camera to the player's position when dead
        if (isDead)
        {
            shouldPos = Vector3.Lerp(gameObject.transform.position, thePlayer.transform.position, Time.deltaTime * 2);
            gameObject.transform.position = new Vector3(shouldPos.x, 1, shouldPos.z);
        }
    }
Пример #25
0
 //Arret du score quand le joueur perd
 public void OnDeath()
 {
     isDead = true;
     if (PlayerPrefs.GetFloat("HighScore Distance :") < score_distance)
     {
         PlayerPrefs.SetFloat("HighScore Distance :", score_distance);
     }
     if (PlayerPrefs.GetFloat("HighScore Piece :") < count_piece)
     {
         PlayerPrefs.SetFloat("HighScore Piece :", count_piece);
     }
     deathMenu.ToggleEndMenu(score_distance, count_piece);
 }
Пример #26
0
    public void OnDeath()
    {
        // this method will be called from the playerMotor script;
        // when player collides with onj, this method will be called in PlayerMotor and will stop the Score from increasing
        isDead = true;

        if (PlayerPrefs.GetFloat("Highscore") < score)         // if highscore is smaller than score assign new highscore.
        {
            PlayerPrefs.SetFloat("Highscore", score);          // save the score to the user's device's storage
        }

        deathMenu.ToggleEndMenu(score);         // turns on the death menu, and sends the player's score to be displayed on the death menu
    }
Пример #27
0
    public void OnDeath()
    {
        isDead = true;
        //deathMenu.ToggleEndMenu(score);
        if ((int)PlayerPrefs.GetFloat("Highscore") < score)
        {
            NHS.text = "NEW HIGH SCORE!!";

            PlayerPrefs.SetFloat("Highscore", score);
        }
        deathMenu.ToggleEndMenu(score);
        AddScoreToLeaderBoard(lead, (int)score);
    }
Пример #28
0
    void OnTriggerEnter(Collider other)
    {
        /*
         * Player.transform.position = respawnPoint.transform.position;
         * Debug.Log("You die!!"); */

        if (other.gameObject.tag == "Player")
        {
            deathMenu.ToggleEndMenu();
            //Destroy(gameObject);
            Debug.Log("You die! Back to start place!");
            Player.transform.position = respawnPoint.transform.position;
        }
    }
Пример #29
0
 private void endGame()
 {
     GameObject.FindGameObjectWithTag("Life" + life).SetActive(false);
     LifeLost[LifeCounter].SetActive(true);
     //GameObject.FindGameObjectWithTag("LifeLost" + life).SetActive(true);
     LifeCounter++;
     life -= 1;
     if (life == 0)
     {
         ended = true;
         speed = 0;
         deathMenu.ToggleEndMenu(Score.GetComponent <ManageScore>().score);
     }
 }
Пример #30
0
 public void Death()
 {
     if (!mute)
     {
         orig.Stop();
         slow.Play();
     }
     isDead = true;
     zm.onDead();
     cm.onDead();
     gm.onDead();
     GetComponent <BallMovement>().onDead();
     deathMenu.ToggleEndMenu();
 }