public IEnumerator Jump() { float timeCount = 0; Velocity.y = JumpSpeed; PlaySound(JumpClip); while (true) { yield return(new WaitForFixedUpdate()); timeCount += Time.fixedDeltaTime; if (!InputUtils.GetMainKey()) { yield break; } if (timeCount < JumpTMax && timeCount >= JumpTMin) { Velocity.y += JumpHoldAcc * Time.fixedDeltaTime; } else if (timeCount >= JumpTMax) { yield break; } } }
// Update is called once per frame void Update() { if (InputUtils.GetMainKey()) { if (start) { return; } start = true; StartCoroutine(StartProcess()); } }