Player Rotation
The PlayerRotation
is responsible for managing the rotation of the player character based on different states.
Properties
public PlayerWorker playerWorker
: References thePlayerWorker
associated withPlayerRotation
.public PlayerAttackRotation playerAttackRotation
: References the rotation of the player when performing an attack.public PlayerMovementRotation playerMovementRotation
: References the rotation of the player during movement.
Constructor
public PlayerRotation(PlayerWorker playerWorker)
: Initializes a new instance of thePlayerRotation
class, assigning thePlayerWorker
. Also initializes instances ofPlayerAttackRotation
andPlayerMovementRotation
to handle rotation during attacking and moving, respectively.
Methods
public void OnUpdate()
: callsRotate
on each frame.public void SetMovementTargetRotation(Vector3 rotation)
: Sets the target rotation for the player when moving. The target rotation is represented by aVector3
and is converted to aQuaternion
for the internal representation.public void Rotate()
: Determines how the player character should rotate based on the current state (moving or attacking). If the player is moving, it invokes theRotate
method ofPlayerMovementRotation
; if the player is attacking, it invokes theRotate
method ofPlayerAttackRotation
.
Last updated