C# Класс 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.
Наследование: Component, IUpdatable
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
camera Camera
deadzone RectangleF
focusOffset Vector2
followLerp float
mapLockEnabled bool
mapSize Vector2

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
clampToMapSize ( Vector2 position ) : Vector2

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

Описание методов

FollowCamera() публичный Метод

public FollowCamera ( System.Entity targetEntity ) : System
targetEntity System.Entity
Результат System

FollowCamera() публичный Метод

public FollowCamera ( System.Entity targetEntity, Camera camera ) : System
targetEntity System.Entity
camera Camera
Результат System

IUpdatable() публичный Метод

public IUpdatable ( ) : void
Результат void

debugRender() публичный Метод

public debugRender ( Graphics graphics ) : void
graphics Graphics
Результат void

follow() публичный Метод

public follow ( System.Entity targetEntity, CameraStyle cameraStyle = CameraStyle.CameraWindow ) : void
targetEntity System.Entity
cameraStyle CameraStyle
Результат void

onAddedToEntity() публичный Метод

public onAddedToEntity ( ) : void
Результат void

onGraphicsDeviceReset() публичный Метод

public onGraphicsDeviceReset ( ) : void
Результат void

onRemovedFromEntity() публичный Метод

public onRemovedFromEntity ( ) : void
Результат void

setCenteredDeadzone() публичный Метод

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.
Результат void

updateFollow() публичный Метод

public updateFollow ( ) : void
Результат void

Описание свойств

camera публичное свойство

public Camera,Nez camera
Результат Camera

deadzone публичное свойство

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
Результат RectangleF

focusOffset публичное свойство

offset from the screen center that the camera will focus on
public Vector2 focusOffset
Результат Vector2

followLerp публичное свойство

how fast the camera closes the distance to the target position
public float followLerp
Результат float

mapLockEnabled публичное свойство

If true, the camera position will not got out of the map rectangle (0,0, mapwidth, mapheight)
public bool mapLockEnabled
Результат bool

mapSize публичное свойство

Contains the width and height of the current map.
public Vector2 mapSize
Результат Vector2