IEnumerator ListenForReturn() { float countdown = 3; float time = 0f; listening = true; while (listening) { var exit = Input.GetAxis("Submit"); if (exit != 0) { HelperTools.ToggleOn(textCG); countdown = Mathf.Ceil(3f - 2f * (Time.time - time)); CountdownText.text = "" + countdown; if (countdown <= 0) { HelperTools.ToggleOff(textCG); yield return(ReturnToTheLab()); } } else { HelperTools.ToggleOff(textCG); time = Time.time; countdown = 3; } yield return(null); } }
public void ResetRace() { if (!Racing) { return; } RacingToggleEvent.Invoke(); StartAreaGameObject.transform.position = originalStartAreaPosition; Racing = false; Finished = false; transform.position = startPos; transform.rotation = startRotation; Camera.main.transform.position = startCameraPos; Camera.main.transform.rotation = startCameraRot; Camera.main.orthographicSize = startCameraSize; Camera.main.transform.SetParent(startCameraParent); RacingWarble.GetComponent <GeneBehaviorController>().enabled = false; RacingWarble.transform.position = startPos; RacingWarble.transform.SetParent(originalWarbleParent); RacingWarble = null; timer.StopTimer(); input.ActiveWarble = null; currentPosition = 0; if (notepadOn) { HelperTools.ToggleOn(NotepadCG); } }
IEnumerator WaitForRaceEnd() { while (OldGM.Instance.Racing) { yield return(new WaitForSeconds(0.1f)); } HelperTools.ToggleOn(cgRandom); }
void Update() { var input = Input.GetAxis("Submit"); if (input != 0f) { HelperTools.ToggleOn(cg); } }
public void StartTimer() { TimeLeft = StartCountdownFrom; AdditionalTime = 0f; startTime = Time.time; counting = true; HelperTools.ToggleOn(cg); StartCoroutine(Counting()); }
private void OnTriggerExit(Collider other) { if (gameManager.Racing) { return; } if (countdownCoroutine != null) { StopCoroutine(countdownCoroutine); countdownCoroutine = null; } keepFading = false; HelperTools.ToggleOn(cgRandom); HelperTools.ToggleOff(cgCountdown); }
private void OnTriggerEnter(Collider other) { if (gameManager.Racing) { return; } HelperTools.ToggleOff(cgRandom); HelperTools.ToggleOn(cgCountdown); if (countdownCoroutine == null) { countdownCoroutine = StartCoroutine(Countdown(other.gameObject)); } }