Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        //transform.Translate(5f * Time.deltaTime, 0f, 0f);
        if (Input.GetButtonDown("Jump"))
        {
            if (touchingPlatform)
            {
                rigidbody.AddForce(jumpVelocity, ForceMode.VelocityChange);
                touchingPlatform = false;
            }
            else if (boosts > 0)
            {
                rigidbody.AddForce(boostVelocity, ForceMode.VelocityChange);
                boosts -= 1;
                GUIManager.SetBoosts(boosts);
            }
        }
        distanceTraveled = transform.localPosition.x;
        GUIManager.SetDistance(distanceTraveled);

        if (transform.localPosition.y < gameOverY)
        {
            GameEventManger.TriggerGameOver();
        }
    }
Ejemplo n.º 2
0
 void Update()
 {
     if (Input.GetButtonDown("Jump"))
     {
         GameEventManger.TriggerGameStart();
     }
 }