Player Camera
PlayerCamera
is responsible for managing the main camera's positioning and orientation in the game.
Properties
private PlayerWorker playerWorker
: References thePlayerWorker
associated withPlayerCamera
private Transform cameraTransform
: References the transform component of the main camera.private float angle
: Represents the angle at which the camera is set relative to the player.private float rotationSpeed
: Represents the camera rotation speed.private float yRotation
: Represents the horizontal rotation of the camera.private float cameraDistance
: Represents the distance between the camera and the player.
Constructor
public PlayerCamera(PlayerWorker playerWorker)
: Initializes a new instance of thePlayerCamera
class, assigning thePlayerWorker
.
Methods
public void OnStart()
: Invoked at Player Start and focuses the main camera on the local player character.public void OnLateUpdate()
: Invoked at Player Late Update and rotates the camera based on player input.public void FocusMainCameraToOwnerPlayer()
: Acquires the main camera's transform and callsRotateCamera()
public void RotateCamera()
: Calculates and applies the camera's position and rotation based on player input, rotation speed, and predefined angle.
Last updated