private void ProcessMovement() { if (canMove) { if (PInput.InputDir != Vector2.zero) { runTimer += Time.deltaTime; PAnimator.SetBool("IsMoving", true); } else { runTimer -= Time.deltaTime * deaccelFactor; PAnimator.SetBool("IsMoving", false); } } else { runTimer = 0; PAnimator.SetBool("IsMoving", false); } isMoving = PAnimator.GetBool("IsMoving"); runTimer = Mathf.Clamp01(runTimer); //evaluate what our speed is according to the acceleration curve currentSpeed = accelCurve.Evaluate(runTimer) * moveSpeed; velocity = (transform.forward * currentSpeed); velocity += Vector3.up * gravity; CharController.Move(velocity * Time.deltaTime); }
private void Update() { if (photonView.isMine) { if (PInput.WhackButton && PMovement.CanMove) { PAnimator.SetBool("Whack", true); } } }
/// <summary> /// Knocks the player down and become invincible for a short period of time /// </summary> public void Whacked() { isInvincible = true; PAnimator.SetBool("KnockedDown", true); hitStop.PlayHitStop(); StartCoroutine("InvincibilityFlicker"); StartCoroutine("ResetKnockedDown"); //StartCoroutine("KnockAway", direction); }
private IEnumerator ResetKnockedDown() { float timer = 0; float inTime = .5f; while (timer <= inTime) { timer += Time.deltaTime; yield return(new WaitForEndOfFrame()); } PAnimator.SetBool("KnockedDown", false); }