void OnGUI() { if (Time.timeScale == 0f) { if (GUI.Button(new Rect(0, 50, 50, 50), "Level1")) { Application.LoadLevel(Application.loadedLevel); NbackGenerator.setLevel(1); } else if (GUI.Button(new Rect(0, 100, 50, 50), "Level2")) { Application.LoadLevel(Application.loadedLevel); NbackGenerator.setLevel(2); } else if (GUI.Button(new Rect(0, 150, 50, 50), "Level3")) { Application.LoadLevel(Application.loadedLevel); NbackGenerator.setLevel(3); } else if (GUI.Button(new Rect(0, 200, 50, 50), "Level4")) { Application.LoadLevel(Application.loadedLevel); NbackGenerator.setLevel(4); } else if (GUI.Button(new Rect(0, 250, 50, 50), "Level5")) { Application.LoadLevel(Application.loadedLevel); NbackGenerator.setLevel(5); } } }
// Update is called once per frame void Update() { if (this.GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).IsName("PlayerBoostFall")) { justJumped = false; } if (jumpEnabled && canJump && Input.GetKeyDown("space")) { if (onGround) { StartCoroutine("InitJumpDelay", jumpDelayNum); } else { this.GetComponent <Animator>().SetInteger("PlayerState", 2); Jump(); } } if (canRun) { transform.Translate(new Vector3(runningSpeed * Time.deltaTime, 0f, 0f)); } UpdateTouch(); NbackPlatformsInput(); this.GetComponent <Animator>().SetBool("PlayerInAir", !onGround); LivesText.GetComponent <Text>().text = "Lives: " + numLives.ToString(); if (numLives <= 0) { int n = NbackGenerator.currentLevel; Application.LoadLevel(Application.loadedLevel); NbackGenerator.setLevel(n); } }