C# Class Nez.FollowCamera

basic follow camera. LockOn mode uses no deadzone and just centers the camera on the target. CameraWindow mode wraps a deadzone around the target allowing it to move within the deadzone without moving the camera.
Inheritance: Component, IUpdatable
Afficher le fichier Open project: prime31/Nez

Méthodes publiques

Свойство Type Description
camera Camera
deadzone RectangleF
focusOffset Vector2
followLerp float
mapLockEnabled bool
mapSize Vector2

Méthodes publiques

Méthode Description
FollowCamera ( System.Entity targetEntity ) : System
FollowCamera ( System.Entity targetEntity, Camera camera ) : System
IUpdatable ( ) : void
debugRender ( Graphics graphics ) : void
follow ( System.Entity targetEntity, CameraStyle cameraStyle = CameraStyle.CameraWindow ) : void
onAddedToEntity ( ) : void
onGraphicsDeviceReset ( ) : void
onRemovedFromEntity ( ) : void
setCenteredDeadzone ( int width, int height ) : void

sets up the deadzone centered in the current cameras bounds with the given size

updateFollow ( ) : void

Private Methods

Méthode Description
clampToMapSize ( Vector2 position ) : Vector2

Clamps the camera so it never leaves the visible area of the map.

Method Details

FollowCamera() public méthode

public FollowCamera ( System.Entity targetEntity ) : System
targetEntity System.Entity
Résultat System

FollowCamera() public méthode

public FollowCamera ( System.Entity targetEntity, Camera camera ) : System
targetEntity System.Entity
camera Camera
Résultat System

IUpdatable() public méthode

public IUpdatable ( ) : void
Résultat void

debugRender() public méthode

public debugRender ( Graphics graphics ) : void
graphics Graphics
Résultat void

follow() public méthode

public follow ( System.Entity targetEntity, CameraStyle cameraStyle = CameraStyle.CameraWindow ) : void
targetEntity System.Entity
cameraStyle CameraStyle
Résultat void

onAddedToEntity() public méthode

public onAddedToEntity ( ) : void
Résultat void

onGraphicsDeviceReset() public méthode

public onGraphicsDeviceReset ( ) : void
Résultat void

onRemovedFromEntity() public méthode

public onRemovedFromEntity ( ) : void
Résultat void

setCenteredDeadzone() public méthode

sets up the deadzone centered in the current cameras bounds with the given size
public setCenteredDeadzone ( int width, int height ) : void
width int Width.
height int Height.
Résultat void

updateFollow() public méthode

public updateFollow ( ) : void
Résultat void

Property Details

camera public_oe property

public Camera,Nez camera
Résultat Camera

deadzone public_oe property

when in CameraWindow mode the width/height is used as a bounding box to allow movement within it without moving the camera. when in LockOn mode only the deadzone x/y values are used. This is set to sensible defaults when you call follow but you are free to override it to get a custom deadzone directly or via the helper setCenteredDeadzone.
public RectangleF deadzone
Résultat RectangleF

focusOffset public_oe property

offset from the screen center that the camera will focus on
public Vector2 focusOffset
Résultat Vector2

followLerp public_oe property

how fast the camera closes the distance to the target position
public float followLerp
Résultat float

mapLockEnabled public_oe property

If true, the camera position will not got out of the map rectangle (0,0, mapwidth, mapheight)
public bool mapLockEnabled
Résultat bool

mapSize public_oe property

Contains the width and height of the current map.
public Vector2 mapSize
Résultat Vector2