// Update is called once per frame void Update() { // Read the Time Trial variable isInTimeTrial = StartScreen.timeTrial; if (ss.userInput != false && cs.lose != true) { if (Input.GetButtonDown("Jump") && cs.isGounded && !isCharging) { startedGame = true; ss.SendMessage("RemoveInstructions"); cs.SendMessage("JumpAnim"); GameObject jumpBar = Instantiate(jumpPower) as GameObject; isCharging = true; } if (Input.GetButtonUp("Jump") && cs.isGounded && isCharging) { cs.isGounded = false; cs.SendMessage("LandAnim"); isCharging = false; GameObject powerObject = GameObject.FindWithTag("Power"); if (powerObject != null) { jumpS.PlayOneShot(jumpSound); Jump jump = powerObject.GetComponent("Jump") as Jump; Destroy(powerObject); GameObject.FindWithTag("Player").SendMessage("Jump", maxJumpForce * jump.chargePower + 380); } } // Time Trial Timer if (isInTimeTrial == true && startedGame == true) { GameObject timerText = GameObject.FindWithTag("TimerText"); if (timerText != null) { timerText.SendMessage("CountDown"); } } if (cs.isGounded == false) { Destroy(GameObject.FindWithTag("Power")); } } if (isInTimeTrial == true && cs.lose == true) { startedGame = false; } if (cs.lose == true) { Destroy(GameObject.FindWithTag("Power")); } }