/// <summary> Updates this object. </summary> public void Update() { if (Animator.AttackBehaviour.IsAttacking == false) { if (InputSource.WasAttackPressed() && Mover.IsGrounded) { StartAttacking(); } Mover.SetIntendedVelocity(GetIntendedVelocity()); Mover.CheckGrounding(); if (InputSource.WasDashPressed() && Mover.IsGrounded) { Mover.Dash(dashDistance); } if (InputSource.WasJumpPressed() && Mover.IsGrounded) { Mover.Jump(jumpHeight); } } else { Mover.SetIntendedVelocity(Vector3.zero); } }
/// <summary> Gets intended velocity. </summary> /// <returns> The intended velocity. </returns> protected Vector3 GetIntendedVelocity() { Mover.CheckGrounding(); if (Mover.IsGrounded) { return(Vector3.zero); } return(Vector3.down * fallSpeed); }