protected virtual void Update() { AniSpeed = new Vector2(AimVelocity.x, AimVelocity.z).magnitude / behaviourSetting.RunSpeed; if (behaviourSetting.HasHand && FixAniParamFlag) { FixAniParamFlag = false; Item item = HoldingItemL ?? HoldingItemR; if (item && item is Weapon) { SetWeaponInfo((Weapon)item); } else { SetWeaponInfo(); } } Chr.Move(AimVelocity * Time.deltaTime); bool onGround = Chr.isGrounded; if (onGround) { CurrentJumpCount = 0; } AimVelocity.y += onGround ? 0f : Physics.gravity.y * 10f * Time.deltaTime; AniOnGround = onGround; }
protected virtual void Update() { // Gravity AimVelocity.y = Mathf.Clamp(AimVelocity.y + Physics.gravity.y, -MAX_DROP_SPEED, MAX_DROP_SPEED); // OnGround if (!Chr.isGrounded) { AimVelocity.x = 0f; AimVelocity.z = 0f; } // Move CurrentVelocity = Vector3.Lerp(CurrentVelocity, AimVelocity, MoveLerpRate); Chr.Move(CurrentVelocity * Time.deltaTime); // Rotate transform.rotation = AimRotation; }