Corgi Engine  v8.8
MoreMountains.CorgiEngine.CameraController Class Reference

The Corgi Engine's Camera Controller. Handles camera movement, shakes, player follow. More...

Inheritance diagram for MoreMountains.CorgiEngine.CameraController:
MoreMountains.CorgiEngine.CorgiMonoBehaviour MoreMountains.Tools.MMEventListener< CorgiEngineEvent > MoreMountains.Tools.MMEventListener< MMCameraEvent >

Public Member Functions

virtual void SetTarget (Transform newTarget)
 Sets a new target for the camera More...
 
virtual void Shake (Vector3 shakeParameters)
 Use this method to shake the camera, passing in a Vector3 for intensity, duration and decay More...
 
virtual void LookUp ()
 Moves the camera up More...
 
virtual void LookDown ()
 Moves the camera down More...
 
virtual void ResetLookUpDown ()
 Resets the look direction modifier More...
 
virtual void OnMMEvent (CorgiEngineEvent corgiEngineEvent)
 When the player respawns, we reinitialize this object. More...
 
virtual void StartFollowing ()
 Makes the camera follow its target More...
 
virtual void StopFollowing ()
 Stops the camera from folliwing its target More...
 
virtual void OnMMEvent (MMCameraEvent cameraEvent)
 Acts on MMCameraEvents when caught More...
 
virtual void OnCameraShakeEvent (float duration, float amplitude, float frequency, float amplitudeX, float amplitudeY, float amplitudeZ, bool infinite, MMChannelData channelData, bool useUnscaledTime)
 When a MMCameraShakeEvent is caught, shakes the camera More...
 
virtual void TeleportCameraToTarget ()
 Teleports the camera to its target's position plus the specified offsets More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< CorgiEngineEvent >
void OnMMEvent (T eventType)
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< MMCameraEvent >
void OnMMEvent (T eventType)
 

Public Attributes

float HorizontalLookDistance = 3
 How far ahead from the Player the camera is supposed to be
More...
 
Vector3 CameraOffset
 Vertical Camera Offset
More...
 
float LookAheadTrigger = 0.1f
 Minimal distance that triggers look ahead. More...
 
float ManualUpDownLookDistance = 3
 How high (or low) from the Player the camera should move when looking up/down. More...
 
float ResetSpeed = 0.5f
 How fast the camera goes back to the Player. More...
 
float CameraSpeed = 0.3f
 How fast the camera moves. More...
 
float MinimumZoom = 5f
 the minimum camera zoom More...
 
float MaximumZoom = 10f
 the maximum camera zoom More...
 
float ZoomSpeed = 0.4f
 the speed at which the camera zooms More...
 
bool PixelPerfect = false
 if this is true, the script will resize the camera's orthographic size on start to match the desired size and PPU More...
 
int ReferenceVerticalResolution = 768
 the vertical resolution for which you've created your visual assets More...
 
float ReferencePixelsPerUnit = 32
 the reference PPU value (the one you set on your sprites) More...
 
bool EnableEffectsOnMobile = false
 If set to false, all Cinematic Effects on the camera will be removed at start on mobile targets. More...
 
bool InstantRepositionCameraOnRespawn = false
 if this is true, the camera will teleport to the player's location on respawn, otherwise it'll move there at its regular speed More...
 
bool AssignCameraOnSpawn = true
 if this is true, the camera will auto assign on spawn and respawn More...
 
Transform Target
 the current transform target for this camera More...
 
CorgiController TargetController
 the current CorgiController that this camera targets More...
 
bool StartFollowingBtn
 
bool StopFollowingBtn
 

Protected Member Functions

virtual void Initialization ()
 Initialization More...
 
virtual void AssignTarget ()
 Assigns a target to the camera, usually the first player More...
 
virtual void LateUpdate ()
 Every frame, we move the camera if needed More...
 
virtual void MakeCameraPixelPerfect ()
 Makes the camera pixel perfect by resizing its orthographic size according to the current screen's size. More...
 
virtual void FollowPlayer ()
 Moves the camera around so it follows the player More...
 
virtual void Zoom ()
 Handles the zoom of the camera based on the main character's speed More...
 
virtual void GetLevelBounds ()
 Gets the levelbounds coordinates to lock the camera into the level More...
 
virtual void OnEnable ()
 On enable, we start listening to events More...
 
virtual void OnDisable ()
 On disable, we stop listening to events More...
 

Protected Attributes

Bounds _levelBounds
 
float _xMin
 
float _xMax
 
float _yMin
 
float _yMax
 
float _offsetZ
 
Vector3 _lastTargetPosition
 
Vector3 _currentVelocity
 
Vector3 _lookAheadPos
 
float _shakeIntensity
 
float _shakeDecay
 
float _shakeDuration
 
float _currentZoom
 
Camera _camera
 
Vector3 _lookDirectionModifier = new Vector3(0,0,0)
 

Properties

bool FollowsPlayer [get, set]
 True if the camera should follow the player. More...
 

Detailed Description

The Corgi Engine's Camera Controller. Handles camera movement, shakes, player follow.

Member Function Documentation

◆ AssignTarget()

virtual void MoreMountains.CorgiEngine.CameraController.AssignTarget ( )
protectedvirtual

Assigns a target to the camera, usually the first player

◆ FollowPlayer()

virtual void MoreMountains.CorgiEngine.CameraController.FollowPlayer ( )
protectedvirtual

Moves the camera around so it follows the player

◆ GetLevelBounds()

virtual void MoreMountains.CorgiEngine.CameraController.GetLevelBounds ( )
protectedvirtual

Gets the levelbounds coordinates to lock the camera into the level

◆ Initialization()

virtual void MoreMountains.CorgiEngine.CameraController.Initialization ( )
protectedvirtual

Initialization

◆ LateUpdate()

virtual void MoreMountains.CorgiEngine.CameraController.LateUpdate ( )
protectedvirtual

Every frame, we move the camera if needed

◆ LookDown()

virtual void MoreMountains.CorgiEngine.CameraController.LookDown ( )
virtual

Moves the camera down

◆ LookUp()

virtual void MoreMountains.CorgiEngine.CameraController.LookUp ( )
virtual

Moves the camera up

◆ MakeCameraPixelPerfect()

virtual void MoreMountains.CorgiEngine.CameraController.MakeCameraPixelPerfect ( )
protectedvirtual

Makes the camera pixel perfect by resizing its orthographic size according to the current screen's size.

◆ OnCameraShakeEvent()

virtual void MoreMountains.CorgiEngine.CameraController.OnCameraShakeEvent ( float  duration,
float  amplitude,
float  frequency,
float  amplitudeX,
float  amplitudeY,
float  amplitudeZ,
bool  infinite,
MMChannelData  channelData,
bool  useUnscaledTime 
)
virtual

When a MMCameraShakeEvent is caught, shakes the camera

Parameters
shakeEventShake event.

◆ OnDisable()

virtual void MoreMountains.CorgiEngine.CameraController.OnDisable ( )
protectedvirtual

On disable, we stop listening to events

◆ OnEnable()

virtual void MoreMountains.CorgiEngine.CameraController.OnEnable ( )
protectedvirtual

On enable, we start listening to events

◆ OnMMEvent() [1/2]

virtual void MoreMountains.CorgiEngine.CameraController.OnMMEvent ( CorgiEngineEvent  corgiEngineEvent)
virtual

When the player respawns, we reinitialize this object.

Parameters
checkpointCheckpoint.
playerPlayer.

◆ OnMMEvent() [2/2]

virtual void MoreMountains.CorgiEngine.CameraController.OnMMEvent ( MMCameraEvent  cameraEvent)
virtual

Acts on MMCameraEvents when caught

Parameters
cameraEvent

◆ ResetLookUpDown()

virtual void MoreMountains.CorgiEngine.CameraController.ResetLookUpDown ( )
virtual

Resets the look direction modifier

◆ SetTarget()

virtual void MoreMountains.CorgiEngine.CameraController.SetTarget ( Transform  newTarget)
virtual

Sets a new target for the camera

Parameters
newTarget

◆ Shake()

virtual void MoreMountains.CorgiEngine.CameraController.Shake ( Vector3  shakeParameters)
virtual

Use this method to shake the camera, passing in a Vector3 for intensity, duration and decay

Parameters
shakeParametersShake parameters : intensity, duration and decay.

◆ StartFollowing()

virtual void MoreMountains.CorgiEngine.CameraController.StartFollowing ( )
virtual

Makes the camera follow its target

◆ StopFollowing()

virtual void MoreMountains.CorgiEngine.CameraController.StopFollowing ( )
virtual

Stops the camera from folliwing its target

◆ TeleportCameraToTarget()

virtual void MoreMountains.CorgiEngine.CameraController.TeleportCameraToTarget ( )
virtual

Teleports the camera to its target's position plus the specified offsets

◆ Zoom()

virtual void MoreMountains.CorgiEngine.CameraController.Zoom ( )
protectedvirtual

Handles the zoom of the camera based on the main character's speed

Member Data Documentation

◆ _camera

Camera MoreMountains.CorgiEngine.CameraController._camera
protected

◆ _currentVelocity

Vector3 MoreMountains.CorgiEngine.CameraController._currentVelocity
protected

◆ _currentZoom

float MoreMountains.CorgiEngine.CameraController._currentZoom
protected

◆ _lastTargetPosition

Vector3 MoreMountains.CorgiEngine.CameraController._lastTargetPosition
protected

◆ _levelBounds

Bounds MoreMountains.CorgiEngine.CameraController._levelBounds
protected

◆ _lookAheadPos

Vector3 MoreMountains.CorgiEngine.CameraController._lookAheadPos
protected

◆ _lookDirectionModifier

Vector3 MoreMountains.CorgiEngine.CameraController._lookDirectionModifier = new Vector3(0,0,0)
protected

◆ _offsetZ

float MoreMountains.CorgiEngine.CameraController._offsetZ
protected

◆ _shakeDecay

float MoreMountains.CorgiEngine.CameraController._shakeDecay
protected

◆ _shakeDuration

float MoreMountains.CorgiEngine.CameraController._shakeDuration
protected

◆ _shakeIntensity

float MoreMountains.CorgiEngine.CameraController._shakeIntensity
protected

◆ _xMax

float MoreMountains.CorgiEngine.CameraController._xMax
protected

◆ _xMin

float MoreMountains.CorgiEngine.CameraController._xMin
protected

◆ _yMax

float MoreMountains.CorgiEngine.CameraController._yMax
protected

◆ _yMin

float MoreMountains.CorgiEngine.CameraController._yMin
protected

◆ AssignCameraOnSpawn

bool MoreMountains.CorgiEngine.CameraController.AssignCameraOnSpawn = true

if this is true, the camera will auto assign on spawn and respawn

◆ CameraOffset

Vector3 MoreMountains.CorgiEngine.CameraController.CameraOffset

Vertical Camera Offset

◆ CameraSpeed

float MoreMountains.CorgiEngine.CameraController.CameraSpeed = 0.3f

How fast the camera moves.

◆ EnableEffectsOnMobile

bool MoreMountains.CorgiEngine.CameraController.EnableEffectsOnMobile = false

If set to false, all Cinematic Effects on the camera will be removed at start on mobile targets.

◆ HorizontalLookDistance

float MoreMountains.CorgiEngine.CameraController.HorizontalLookDistance = 3

How far ahead from the Player the camera is supposed to be

◆ InstantRepositionCameraOnRespawn

bool MoreMountains.CorgiEngine.CameraController.InstantRepositionCameraOnRespawn = false

if this is true, the camera will teleport to the player's location on respawn, otherwise it'll move there at its regular speed

◆ LookAheadTrigger

float MoreMountains.CorgiEngine.CameraController.LookAheadTrigger = 0.1f

Minimal distance that triggers look ahead.

◆ ManualUpDownLookDistance

float MoreMountains.CorgiEngine.CameraController.ManualUpDownLookDistance = 3

How high (or low) from the Player the camera should move when looking up/down.

◆ MaximumZoom

float MoreMountains.CorgiEngine.CameraController.MaximumZoom = 10f

the maximum camera zoom

◆ MinimumZoom

float MoreMountains.CorgiEngine.CameraController.MinimumZoom = 5f

the minimum camera zoom

◆ PixelPerfect

bool MoreMountains.CorgiEngine.CameraController.PixelPerfect = false

if this is true, the script will resize the camera's orthographic size on start to match the desired size and PPU

◆ ReferencePixelsPerUnit

float MoreMountains.CorgiEngine.CameraController.ReferencePixelsPerUnit = 32

the reference PPU value (the one you set on your sprites)

◆ ReferenceVerticalResolution

int MoreMountains.CorgiEngine.CameraController.ReferenceVerticalResolution = 768

the vertical resolution for which you've created your visual assets

◆ ResetSpeed

float MoreMountains.CorgiEngine.CameraController.ResetSpeed = 0.5f

How fast the camera goes back to the Player.

◆ StartFollowingBtn

bool MoreMountains.CorgiEngine.CameraController.StartFollowingBtn

◆ StopFollowingBtn

bool MoreMountains.CorgiEngine.CameraController.StopFollowingBtn

◆ Target

Transform MoreMountains.CorgiEngine.CameraController.Target

the current transform target for this camera

◆ TargetController

CorgiController MoreMountains.CorgiEngine.CameraController.TargetController

the current CorgiController that this camera targets

◆ ZoomSpeed

float MoreMountains.CorgiEngine.CameraController.ZoomSpeed = 0.4f

the speed at which the camera zooms

Property Documentation

◆ FollowsPlayer

bool MoreMountains.CorgiEngine.CameraController.FollowsPlayer
getset

True if the camera should follow the player.


The documentation for this class was generated from the following file: