Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.PlatformerProStandardCamera Class Reference

A camera which smoothly centers on the character and also allows movement between zones. More...

Inheritance diagram for PlatformerPro.PlatformerProStandardCamera:
PlatformerPro.PlatformCamera PlatformerPro.PlatformerProMonoBehaviour

Public Member Functions

override void Init ()
 Initialise this instance. More...
 
override void ChangeZone (CameraZone newZone, Character triggeringCharacter=null)
 Changes the zone by smoothly animating to the new zone. More...
 
virtual void ZoneHasBeenChanged (Transform t, Vector3 p)
 Called when the zones the been changed. More...
 
- Public Member Functions inherited from PlatformerPro.PlatformerProMonoBehaviour
virtual void Validate (PlatformerProMonoBehaviour myTarget)
 Override this method if you want to provide custom validation. The actual code should be surrounded by the if UNITY_EDITOR / endif directive. More...
 

Public Attributes

float transitionSpeed
 How fast to move to the new camera zone. More...
 
TweenMode tweenMode
 How to move to the new camera zone. More...
 
bool freezePlayerDuringTransition
 If true the character will be completely frozen during the transition. More...
 
CameraAxisSettings xAxis
 Follow settings for xAxis; More...
 
CameraAxisSettings yAxis
 Follow settings for yAxis; More...
 
bool snapOnRespawn
 If the character is teleported or respawned should be snap to that position or animate to it? More...
 
bool allowZoom
 Can this camera zoom in and out. More...
 
float maximumZoom = 10.0f
 Maximum zoom level. More...
 
CameraZoomMode zoomMode
 How should we implement the zoom? More...
 
Vector2 borderSize = Vector2.one
 How big should the border around the characters be (to enure they can see in 'front' of themselves)? More...
 
- Public Attributes inherited from PlatformerPro.PlatformCamera
bool isDefaultCamera
 Set to true if this is the default camera. More...
 
CameraZone startingZone
 The starting zone. More...
 
System.EventHandler< CameraZoneChangeEventArgsCameraZoneChanged
 Event sent when the camera zone changes. This event is sent when the zone change starts. Add a handler to the tweener to listen to the zone change end for a change that is not instantaneous (or delay your event response). More...
 

Protected Member Functions

override void DoDestroy ()
 Do the destroy actions. More...
 
virtual void HandleCharacterLoaded (object sender, CharacterEventArgs e)
 Handles a character being loaded. More...
 
virtual void HandleCharacterRemoved (object sender, CharacterEventArgs e)
 Handles a character being removed. More...
 
virtual void HandleRespawned (object sender, CharacterEventArgs e)
 Handles the respawned event More...
 
void DoMove ()
 Move the camera More...
 
void DoZoom ()
 Handles the zoom of the camera. More...
 
void MoveInX ()
 Moves the camera in x. More...
 
void MoveInY ()
 Moves the camera in y. More...
 
void LimitToBounds ()
 Limits camera position to the current zones bounds. More...
 
- Protected Member Functions inherited from PlatformerPro.PlatformCamera
virtual void OnCameraZoneChanged (CameraZone oldZone, CameraZone newZone)
 Send the Camera Zone changed event. More...
 

Protected Attributes

float defaultZoom
 The default zoom which comes form the cameras initial value. We cannot zoom in more than the default unless you use code to manually force a zoom level. More...
 
bool movingInX
 Is camera moving in x. More...
 
bool movingInY
 Is camera moving in y. More...
 
List< PlatformerProGameManagercharacterLoaders
 Reference to the character loaders. More...
 
float distanceMovedLastFrameX
 How far did we move last frame in X More...
 
float distanceMovedLastFrameY
 How far did we move last frame in X More...
 
float actualSmoothingFactorX
 The actual smoothing factor in X. More...
 
float actualSmoothingFactorY
 The actual smoothing factor in Y. More...
 
bool isInTransition
 True while the camera is moving. More...
 
PositionTweener tweener
 Tweener which handles any moves. More...
 
CameraZone targetZone
 Zone we are moving to. More...
 
Vector3 targetPosition
 Where are we moving to? More...
 
List< Charactercharacters
 Reference to the character being followed. More...
 
- Protected Attributes inherited from PlatformerPro.PlatformCamera
CameraZone currentZone
 The current zone. More...
 
Camera myCamera
 Cached reference to the associated Unity camera. More...
 

Static Protected Attributes

const float SmoothingFactor = 1.125f
 Never allow frames to move more than this factor relative to previous frame. More...
 
const float MAX_SPEED_FOR_STILL = 0.4f
 If camera movement is smaller than this it is considered still. More...
 
- Static Protected Attributes inherited from PlatformerPro.PlatformCamera
static List< PlatformCameraallCameras
 A list of all camera. More...
 
static PlatformCamera defaultCamera
 The main or default camera. More...
 

Properties

override string Header [get]
 Gets the header string used to describe the component. More...
 
virtual Vector2 AverageTransformPosition [get]
 
- Properties inherited from PlatformerPro.PlatformCamera
CameraZone CurrentZone [get, set]
 Gets the current zone. More...
 
static PlatformCamera DefaultCamera [get]
 Gets the default camera. More...
 
static PlatformCamera[] AllCameras [get]
 Gets the default camera. More...
 
- Properties inherited from PlatformerPro.PlatformerProMonoBehaviour
virtual string Header [get]
 Gets the header string used to describe the component. More...
 
virtual string DocLink [get]
 Gets a link to documentation site. More...
 
virtual string VideoLink [get]
 Gets a link to a youtube video. More...
 
virtual string Deprecated [get]
 If non-null this component is deprecated. The string shows a message indicating how it should be replaced. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from PlatformerPro.PlatformCamera
static void AddCamera (PlatformCamera platformCamera)
 Adds a camera to the global list. More...
 
static void RemoveCamera (PlatformCamera platformCamera)
 Removes a camera from the global list. More...
 
static void SetDefaultCamera ()
 Sets the main camera. More...
 

Detailed Description

A camera which smoothly centers on the character and also allows movement between zones.

Member Function Documentation

◆ ChangeZone()

override void PlatformerPro.PlatformerProStandardCamera.ChangeZone ( CameraZone  newZone,
Character  triggeringCharacter = null 
)
virtual

Changes the zone by smoothly animating to the new zone.

Parameters
newZoneThe zone to move to.
triggeringCharacterCharacter that triggered the transition./param>

Reimplemented from PlatformerPro.PlatformCamera.

◆ DoDestroy()

override void PlatformerPro.PlatformerProStandardCamera.DoDestroy ( )
protectedvirtual

Do the destroy actions.

Reimplemented from PlatformerPro.PlatformCamera.

◆ DoMove()

void PlatformerPro.PlatformerProStandardCamera.DoMove ( )
protected

Move the camera

◆ DoZoom()

void PlatformerPro.PlatformerProStandardCamera.DoZoom ( )
protected

Handles the zoom of the camera.

◆ HandleCharacterLoaded()

virtual void PlatformerPro.PlatformerProStandardCamera.HandleCharacterLoaded ( object  sender,
CharacterEventArgs  e 
)
protectedvirtual

Handles a character being loaded.

Parameters
senderSender.
eEvent args.

◆ HandleCharacterRemoved()

virtual void PlatformerPro.PlatformerProStandardCamera.HandleCharacterRemoved ( object  sender,
CharacterEventArgs  e 
)
protectedvirtual

Handles a character being removed.

Parameters
senderSender.
eEvent args.

◆ HandleRespawned()

virtual void PlatformerPro.PlatformerProStandardCamera.HandleRespawned ( object  sender,
CharacterEventArgs  e 
)
protectedvirtual

Handles the respawned event

Parameters
senderSender.
eEven details.

◆ Init()

override void PlatformerPro.PlatformerProStandardCamera.Init ( )
virtual

Initialise this instance.

Reimplemented from PlatformerPro.PlatformCamera.

◆ LimitToBounds()

void PlatformerPro.PlatformerProStandardCamera.LimitToBounds ( )
protected

Limits camera position to the current zones bounds.

◆ MoveInX()

void PlatformerPro.PlatformerProStandardCamera.MoveInX ( )
protected

Moves the camera in x.

◆ MoveInY()

void PlatformerPro.PlatformerProStandardCamera.MoveInY ( )
protected

Moves the camera in y.

◆ ZoneHasBeenChanged()

virtual void PlatformerPro.PlatformerProStandardCamera.ZoneHasBeenChanged ( Transform  t,
Vector3  p 
)
virtual

Called when the zones the been changed.

Member Data Documentation

◆ actualSmoothingFactorX

float PlatformerPro.PlatformerProStandardCamera.actualSmoothingFactorX
protected

The actual smoothing factor in X.

◆ actualSmoothingFactorY

float PlatformerPro.PlatformerProStandardCamera.actualSmoothingFactorY
protected

The actual smoothing factor in Y.

◆ allowZoom

bool PlatformerPro.PlatformerProStandardCamera.allowZoom

Can this camera zoom in and out.

◆ borderSize

Vector2 PlatformerPro.PlatformerProStandardCamera.borderSize = Vector2.one

How big should the border around the characters be (to enure they can see in 'front' of themselves)?

◆ characterLoaders

List<PlatformerProGameManager> PlatformerPro.PlatformerProStandardCamera.characterLoaders
protected

Reference to the character loaders.

◆ characters

List<Character> PlatformerPro.PlatformerProStandardCamera.characters
protected

Reference to the character being followed.

◆ defaultZoom

float PlatformerPro.PlatformerProStandardCamera.defaultZoom
protected

The default zoom which comes form the cameras initial value. We cannot zoom in more than the default unless you use code to manually force a zoom level.

◆ distanceMovedLastFrameX

float PlatformerPro.PlatformerProStandardCamera.distanceMovedLastFrameX
protected

How far did we move last frame in X

◆ distanceMovedLastFrameY

float PlatformerPro.PlatformerProStandardCamera.distanceMovedLastFrameY
protected

How far did we move last frame in X

◆ freezePlayerDuringTransition

bool PlatformerPro.PlatformerProStandardCamera.freezePlayerDuringTransition

If true the character will be completely frozen during the transition.

◆ isInTransition

bool PlatformerPro.PlatformerProStandardCamera.isInTransition
protected

True while the camera is moving.

◆ MAX_SPEED_FOR_STILL

const float PlatformerPro.PlatformerProStandardCamera.MAX_SPEED_FOR_STILL = 0.4f
staticprotected

If camera movement is smaller than this it is considered still.

◆ maximumZoom

float PlatformerPro.PlatformerProStandardCamera.maximumZoom = 10.0f

Maximum zoom level.

◆ movingInX

bool PlatformerPro.PlatformerProStandardCamera.movingInX
protected

Is camera moving in x.

◆ movingInY

bool PlatformerPro.PlatformerProStandardCamera.movingInY
protected

Is camera moving in y.

◆ SmoothingFactor

const float PlatformerPro.PlatformerProStandardCamera.SmoothingFactor = 1.125f
staticprotected

Never allow frames to move more than this factor relative to previous frame.

◆ snapOnRespawn

bool PlatformerPro.PlatformerProStandardCamera.snapOnRespawn

If the character is teleported or respawned should be snap to that position or animate to it?

◆ targetPosition

Vector3 PlatformerPro.PlatformerProStandardCamera.targetPosition
protected

Where are we moving to?

◆ targetZone

CameraZone PlatformerPro.PlatformerProStandardCamera.targetZone
protected

Zone we are moving to.

◆ transitionSpeed

float PlatformerPro.PlatformerProStandardCamera.transitionSpeed

How fast to move to the new camera zone.

◆ tweener

PositionTweener PlatformerPro.PlatformerProStandardCamera.tweener
protected

Tweener which handles any moves.

◆ tweenMode

TweenMode PlatformerPro.PlatformerProStandardCamera.tweenMode

How to move to the new camera zone.

◆ xAxis

CameraAxisSettings PlatformerPro.PlatformerProStandardCamera.xAxis

Follow settings for xAxis;

◆ yAxis

CameraAxisSettings PlatformerPro.PlatformerProStandardCamera.yAxis

Follow settings for yAxis;

◆ zoomMode

CameraZoomMode PlatformerPro.PlatformerProStandardCamera.zoomMode

How should we implement the zoom?

Property Documentation

◆ AverageTransformPosition

virtual Vector2 PlatformerPro.PlatformerProStandardCamera.AverageTransformPosition
getprotected

◆ Header

override string PlatformerPro.PlatformerProStandardCamera.Header
get

Gets the header string used to describe the component.

The header.


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