Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.GameCamera2DDrag Class Reference
Inheritance diagram for AC.GameCamera2DDrag:
AC._Camera

Public Member Functions

override void _Update ()
 
override bool Is2D ()
 Checks if the camera is for 2D games. This is necessary for working out if the MainCamera needs to change its projection matrix. More...
 
override Vector2 GetPerspectiveOffset ()
 Gets the actual horizontal and vertical panning offsets. More...
 
void SetPosition (Vector2 _position)
 Sets the position to a specific point. This does not account for the offset, minimum or maximum values. More...
 
Vector2 GetPosition ()
 Gets the camera's position, relative to its original position. More...
 
- Public Member Functions inherited from AC._Camera
virtual Vector2 CreateRotationOffset ()
 Returns a vector by which to tweak the camera's rotation. The x-axis will control the spin, and the y-axis will control the pitch. More...
 
virtual void SwitchTarget (Transform _target)
 Switches the camera's target. More...
 
virtual void ResetTarget ()
 
virtual void MoveCameraInstant ()
 
void SetSplitScreen ()
 
void RemoveSplitScreen ()
 
bool IsActive ()
 Checks if the Camera is currently the MainCamera's active camera (attachedCamera) More...
 
void MakeActive ()
 

Public Attributes

RotationLock xLock
 
RotationLock yLock
 
float xSpeed = 5f
 
float ySpeed = 5f
 
float xAcceleration = 5f
 
float xDeceleration = 5f
 
float yAcceleration = 5f
 
float yDeceleration = 5f
 
bool invertX
 
bool invertY
 
float minX
 
float maxX
 
float minY
 
float maxY
 
float xOffset
 
float yOffset
 
SpriteRenderer backgroundConstraint = null
 
bool autoScaleToFitBackgroundConstraint = false
 
- Public Attributes inherited from AC._Camera
bool targetIsPlayer = true
 
Transform target
 
bool isDragControlled = false
 
float focalDistance = 10f
 

Protected Member Functions

override void Awake ()
 
override void OnEnable ()
 
override void OnDisable ()
 
virtual Vector2 GetInputVector ()
 
void SetProjection ()
 
void SetOriginalPosition ()
 
void UpdateBackgroundConstraint ()
 
void OnUpdatePlayableScreenArea ()
 
- Protected Member Functions inherited from AC._Camera
virtual void Start ()
 
Vector3 PositionRelativeToCamera (Vector3 _position)
 
Vector3 RightVector ()
 
Vector3 ForwardVector ()
 
float ConstrainAxis (float desired, Vector2 range, bool isAngle=false)
 

Protected Attributes

Vector2 deltaPosition
 
Vector2 position
 
Vector2 perspectiveOffset
 
Vector3 originalPosition
 
bool _is2D
 
Vector2 lastMousePosition
 
Vector2 noInput = Vector2.zero
 
- Protected Attributes inherited from AC._Camera
Char targetChar
 
Camera _camera
 
Vector2 inputMovement
 
bool is2D = false
 

Properties

Vector2 DeltaPosition [get, set]
 
- Properties inherited from AC._Camera
Transform Target [get]
 
Transform CameraTransform [get]
 
Transform Transform [get]
 
Camera Camera [get]
 
bool isFor2D [get, set]
 
virtual TransparencySortMode TransparencySortMode [get]
 
Vector3 TargetForward [get]
 
virtual bool CursorOffsetForcesTranslation [get]
 

Member Function Documentation

◆ _Update()

override void AC.GameCamera2DDrag._Update ( )
virtual

Updates the camera. This is called every frame by StateHandler.

Reimplemented from AC._Camera.

◆ GetPerspectiveOffset()

override Vector2 AC.GameCamera2DDrag.GetPerspectiveOffset ( )
virtual

Gets the actual horizontal and vertical panning offsets.

Returns
The actual horizontal and vertical panning offsets

Reimplemented from AC._Camera.

◆ GetPosition()

Vector2 AC.GameCamera2DDrag.GetPosition ( )

Gets the camera's position, relative to its original position.

Returns
The camera's position, relative to its original position

◆ Is2D()

override bool AC.GameCamera2DDrag.Is2D ( )
virtual

Checks if the camera is for 2D games. This is necessary for working out if the MainCamera needs to change its projection matrix.

Returns
True if the camera is for 2D games

Reimplemented from AC._Camera.

◆ SetPosition()

void AC.GameCamera2DDrag.SetPosition ( Vector2  _position)

Sets the position to a specific point. This does not account for the offset, minimum or maximum values.

Parameters
_positionThe new position for the camera

Member Data Documentation

◆ autoScaleToFitBackgroundConstraint

bool AC.GameCamera2DDrag.autoScaleToFitBackgroundConstraint = false

If True, and backgroundConstraint is set, then the camera will zoom in to fit the background if it is too zoomed out to fit

◆ backgroundConstraint

SpriteRenderer AC.GameCamera2DDrag.backgroundConstraint = null

If set, then the sprite's bounds will be used to set the horizontal and vertical limits, overriding constrainHorizontal and constrainVertical

◆ invertX

bool AC.GameCamera2DDrag.invertX

If True, then X movement will be inverted

◆ invertY

bool AC.GameCamera2DDrag.invertY

If True, then Y movement will be inverted

◆ maxX

float AC.GameCamera2DDrag.maxX

The maximum X value, if xLock = RotationLock.Limited

◆ maxY

float AC.GameCamera2DDrag.maxY

The maximum Y value, if yLock = RotationLock.Limited

◆ minX

float AC.GameCamera2DDrag.minX

The minimum X value, if xLock = RotationLock.Limited

◆ minY

float AC.GameCamera2DDrag.minY

The minimum Y value, if yLock = RotationLock.Limited

◆ xAcceleration

float AC.GameCamera2DDrag.xAcceleration = 5f

The acceleration of X movement

◆ xDeceleration

float AC.GameCamera2DDrag.xDeceleration = 5f

The deceleration of X movement

◆ xLock

RotationLock AC.GameCamera2DDrag.xLock

How X movement is affected (Free, Limited, Locked)

◆ xOffset

float AC.GameCamera2DDrag.xOffset

The X offset

◆ xSpeed

float AC.GameCamera2DDrag.xSpeed = 5f

The speed of X movement

◆ yAcceleration

float AC.GameCamera2DDrag.yAcceleration = 5f

The acceleration of Y movement

◆ yDeceleration

float AC.GameCamera2DDrag.yDeceleration = 5f

The deceleration of Y movement

◆ yLock

RotationLock AC.GameCamera2DDrag.yLock

How Y movement is affected (Free, Limited, Locked)

◆ yOffset

float AC.GameCamera2DDrag.yOffset

The Y offset

◆ ySpeed

float AC.GameCamera2DDrag.ySpeed = 5f

The speed of Y movement