Player Attack Rotation
The PlayerAttackRotation
is responsible for managing the rotation of a player character while performing an attack.
Properties
public PlayerRotation playerRotation
: References thePlayerRotation
associated withPlayerAttackRotation
.private Vector3 targetDirection
: Represents the direction from the player to the attack target.private Quaternion lookRotation
: Represents the desired rotation of the player character to face the attack target.private float rotationSpeed
: Represents the speed at which the player character rotates towards the target.public float rotationAngle
: Represents the angle between the player's current forward direction and the target direction.private bool isStartedRotating
: Represents whether the rotation towards the attack target has started.
Constructor
public PlayerAttackRotation(PlayerRotation playerRotation)
: Initializes a new instance of thePlayerAttackRotation
class, assigning thePlayerRotation
. Also sets up a reset action for when the player's state changes from attacking.
Methods
public void Rotate()
: Handles the rotation of the player character towards the attack target. It calculates the target direction, the required rotation, performs a smooth rotation over time, and manages the animation associated with rotation.public void ResetState()
: Resets the state of rotation, particularly theisStartedRotating
Last updated