Beispiel #1
0
 private void GameStart()
 {
     distanceTraveled = 0f;
     GUIManagerS.SetDistance(distanceTraveled);
     transform.localPosition = startPosition;
     GetComponent <MeshRenderer>().enabled  = true;
     GetComponent <Rigidbody>().isKinematic = false;
     enabled = true;
 }
Beispiel #2
0
 private void GameStart()
 {
     //random = new Color32((byte)Random.Range(100, 150), (byte)Random.Range(100, 170), (byte)Random.Range(200, 255), 255);
     //cam.backgroundColor = random;
     distanceTraveled = 0f;
     GUIManagerS.SetDistance(distanceTraveled);
     transform.localPosition = startPosition;
     GetComponent <MeshRenderer>().enabled  = true;
     GetComponent <Rigidbody>().isKinematic = false;
     enabled = true;
 }
Beispiel #3
0
    void Update()
    {
        if (touchingPlatform && Input.GetButtonDown("Jump"))
        {
            GetComponent <Rigidbody>().AddForce(jumpVelocity, ForceMode.VelocityChange);
            touchingPlatform = false;
        }

        transform.Translate(5f * Time.deltaTime, 0f, 0f);
        distanceTraveled = transform.localPosition.x;
        GUIManagerS.SetDistance(distanceTraveled);

        if (transform.localPosition.y < gameOverY)
        {
            GameEventManagerS.TriggerGameOver();
        }
    }
Beispiel #4
0
    void Update()
    {
        if (touchingPlatform && Input.GetButtonDown("Jump"))
        {
            GetComponent <Rigidbody>().AddForce(jumpVelocity, ForceMode.VelocityChange);
            touchingPlatform = false;
        }

        transform.Translate(5f * Time.deltaTime, 0f, 0f);
        distanceTraveled = transform.localPosition.x;
        GUIManagerS.SetDistance(distanceTraveled);

        if (transform.localPosition.y < gameOverY)
        {
            GameEventManagerS.TriggerGameOver();
        }

        if (SceneManager.GetActiveScene().name == "Level1")
        {
            if (transform.localPosition.x >= 527)
            {
                acceleration = 0;
                jumpVelocity = new Vector3((float)0, (float)0, (float)0);
                GUIManagerS.endLvl();
            }
        }
        else if (SceneManager.GetActiveScene().name == "Level3")
        {
            if (transform.localPosition.x >= 520)
            {
                acceleration = 0;
                jumpVelocity = new Vector3((float)0, (float)0, (float)0);
                GUIManagerS.endLvl();
            }
        }
        else if (SceneManager.GetActiveScene().name == "Level3")
        {
            if (transform.localPosition.x >= 515)
            {
                acceleration = 0;
                jumpVelocity = new Vector3((float)0, (float)0, (float)0);
                GUIManagerS.endLvl();
            }
        }
    }