Adventure Creator  1.72.0
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2019
AC.MainCamera Class Reference
Inheritance diagram for AC.MainCamera:

Public Member Functions

void OnInitGameEngine (bool hideWhileLoading=true)
 
void _LateUpdate ()
 
void ForceOverlayForFrames (int numFrames)
 Forces an overlay for a number of frames. This is used to mask loading and intialisation, and the game will considered a 'cutscene' during this time. More...
 
bool IsShowingForcedOverlay ()
 Checks if an overlay is being enforced via a ForceOverlayForFrames call More...
 
void SetDefaultFadeTexture (Texture2D _fadeTexture)
 Sets the camera's default fade texture, which is used when not temporarily set to something else. More...
 
void RecalculateRects ()
 
void Shake (float _shakeIntensity, float _duration, CameraShakeEffect _shakeEffect, AnimationCurve _shakeCurve=null)
 Shakes the Camera, creating an "earthquake" effect. More...
 
bool IsShaking ()
 Checks if the Camera is shaking. More...
 
void StopShaking ()
 
virtual void PrepareForBackground ()
 
void SetFirstPerson ()
 
void DrawCameraFade ()
 Draws the Camera's fade texture. This is called every OnGUI call by StateHandler. More...
 
float GetFadeAlpha ()
 
Texture2D GetFadeTexture ()
 
void ResetProjection ()
 
void ResetMoving ()
 
void SnapToAttached ()
 
void Crossfade (float _transitionDuration, _Camera _linkedCamera, AnimationCurve _fadeCurve)
 Crossfades to a new _Camera over time. More...
 
void StopCrossfade ()
 
void TakeOverlayScreenshot ()
 
_Camera GetTransitionFromCamera ()
 Gets the _Camera being transitioned from, if the MainCamera is transitioning between two _Cameras. More...
 
void SetGameCamera (_Camera newCamera, float transitionTime=0f, MoveMethod _moveMethod=MoveMethod.Linear, AnimationCurve _animationCurve=null, bool _retainPreviousSpeed=false, bool snapCamera=true)
 Sets a _Camera as the new attachedCamera to follow. More...
 
void SetFadeTexture (Texture2D tex)
 Sets the MainCamera's fade texture More...
 
void FadeOut (float _fadeDuration, Texture2D tempTex, bool forceCompleteTransition=true, CameraFadePauseBehaviour _cameraFadePauseBehaviour=CameraFadePauseBehaviour.Cancel, AnimationCurve _fadeCurve=null)
 Fades the camera out with a custom texture. More...
 
virtual void FadeIn (float _fadeDuration, bool forceCompleteTransition=true, CameraFadePauseBehaviour _cameraFadePauseBehaviour=CameraFadePauseBehaviour.Cancel, AnimationCurve _fadeCurve=null)
 Fades the camera in. More...
 
virtual void FadeOut (float _fadeDuration, bool forceCompleteTransition=true, CameraFadePauseBehaviour _cameraFadePauseBehaviour=CameraFadePauseBehaviour.Cancel, AnimationCurve _fadeCurve=null)
 Fades the camera out. More...
 
virtual bool isFading ()
 Checks if the Camera is fading in our out. More...
 
Vector3 PositionRelativeToCamera (Vector3 _position)
 Converts a point in world space to one relative to the Camera's forward vector. More...
 
Vector3 RightVector ()
 Gets the Camera's right vector. More...
 
Vector3 ForwardVector ()
 Gets the Camera's forward vector, not accounting for pitch. More...
 
void SetCameraRect ()
 
Vector2 CorrectScreenPositionForUnityUI (Vector2 screenPosition)
 Corrects a screen position Vector to account for the MainCamera's viewport Rect. This is necessary when positioning Unity UI RectTransforms while an aspect ratio is enforced, because the original screen position assumes a default Rect. More...
 
Vector2 GetWindowViewportDifference ()
 Gets the difference between the window size and the game's viewport. More...
 
void DrawBorders ()
 
bool IsOrthographic ()
 Checks if the Camera uses orthographic perspective. More...
 
Vector2 LimitToAspect (Vector2 position)
 Limits a point in screen-space to stay within the Camera's rect boundary, if forceAspectRatio in SettingsManager = True. More...
 
bool IsPointInCamera (Vector2 point)
 Checks if a point in screen-space is within the Camera's viewport More...
 
Vector2 GetMainGameViewOffset ()
 Returns the amount by which the screen dimensions are offset as a result of an enforced aspect ratio.
Returns
The screen dimensions

 
Rect LimitMenuToAspect (Rect rect)
 Resizes an OnGUI Rect so that it fits within the Camera's rect, if forceAspectRatio = True in SettingsManager. More...
 
void SetSplitScreen (_Camera _camera1, _Camera _camera2, CameraSplitOrientation _splitOrientation, bool _isTopLeft, float _splitAmountMain, float _splitAmountOther)
 Creates a new split-screen effect. More...
 
void StartSplitScreen (float _splitAmountMain, float _splitAmountOther)
 Adjusts the screen ratio of any active split-screen effect. More...
 
void SetBoxOverlay (_Camera underlayCamera, _Camera overlayCamera, Rect _overlayRect, bool useRectCentre=true)
 Create a new box-overlay effect More...
 
void RemoveSplitScreen ()
 
Rect GetSplitScreenRect (bool isMainCamera)
 Gets a screen Rect of the split-screen camera. More...
 
float GetFocalDistance ()
 Gets the current focal distance. More...
 
void Disable ()
 
void Enable ()
 
bool IsEnabled ()
 Checks if the Camera is enabled. More...
 
void SetCameraTag (string _tag)
 Sets the GameObject's tag. More...
 
void SetAudioState (bool state)
 Sets the state of the AudioListener component. More...
 
_Camera GetLastGameplayCamera ()
 Gets the previously-used gameplay _Camera. More...
 
Vector2 GetPerspectiveOffset ()
 Gets the current perspective offset, as set by a GameCamera2D. More...
 
PlayerData SaveData (PlayerData playerData)
 Saves data related to the camera. More...
 
void LoadData (PlayerData playerData, bool snapCamera=true)
 Restores the camera state from saved data More...
 
void DrawStatus ()
 
void SetTimelineOverride (_Camera cam1, _Camera cam2, float cam2Weight, float _shakeIntensity=0f)
 Overrides the MainCamera's normal behaviour, using Timeline to control it. More...
 
void ReleaseTimelineOverride ()
 Ends Timeline's overriding of normal behaviour, so that the Main Camera resumes normal behaviour. More...
 
void SetTimelineFadeOverride (Texture2D _timelineFadeTexture, float _timelineFadeWeight)
 
void ReleaseTimelineFadeOverride ()
 
Rect GetPlayableScreenArea (bool relativeToScreenSize, bool invertY=false)
 Gets a Rect that describes the area of the screen that the game is played in. This accounts both for the "safe" area of the screen, as well as borders added to due an enforced aspect ratio. More...
 
Vector2 ConvertToMenuSpace (Vector2 point)
 Converts a screen-space position (e.g. the cursor position) into one in the same co-ordinate system as the AC menu system. More...
 
Vector2 ConvertRelativeScreenSpaceToUI (Vector2 point)
 Converts a screen-space position (relative to the screen's actual size) into one in the same co-ordinate system that Unity UI uses. More...
 
bool IsInTransition ()
 
void ShowGUI ()
 

Static Public Member Functions

static bool AllowProjectionShifting (Camera _camera)
 

Public Attributes

_Camera lastNavCamera
 
MainCameraForwardDirection forwardDirection = MainCameraForwardDirection.MainCameraComponent
 

Protected Types

enum  MainCameraMode { NormalSnap, NormalTransition }
 

Protected Member Functions

virtual void OnDestroy ()
 
virtual void OnAfterChangeScene (LoadingGame loadingGame)
 
virtual void RemoveBackground ()
 
void UpdateCameraFade ()
 
void OnEnterGameState (GameState gameState)
 
IEnumerator CheckGameStateNextFrame ()
 
void UpdateLastGameplayCamera ()
 
void UpdateCameraTransition ()
 
IEnumerator StartCrossfade (object[] parms)
 
void SmoothChange (float _transitionDuration, MoveMethod method, AnimationCurve _timeCurve=null)
 
void ReleaseFadeTexture ()
 
void AssignFadeTexture ()
 
void CalculatePlayableScreenArea ()
 
bool SetAspectRatio ()
 
void CalculateUnityUIAspectRatioCorrection ()
 
void CreateBorderCamera ()
 
Vector2 LimitVector (Vector2 point, float xBorder, float yBorder)
 
void SetMidBorder ()
 
void ApplyCameraData (_Camera _camera1, _Camera _camera2, float camera2Weight, MoveMethod _moveMethod=MoveMethod.Linear, AnimationCurve _timeCurve=null)
 
void ApplyCameraData (GameCameraData cameraData1, GameCameraData cameraData2, float camera2Weight, MoveMethod _moveMethod=MoveMethod.Linear, AnimationCurve _timeCurve=null)
 
void ApplyCameraData (GameCameraData cameraData)
 

Protected Attributes

Texture2D fadeTexture
 
Texture2D tempFadeTexture = null
 
_Camera _attachedCamera
 
_Camera lastNavCamera2
 
bool renderFading = true
 
_Camera transitionFromCamera
 
MainCameraMode mainCameraMode = MainCameraMode.NormalSnap
 
bool isCrossfading
 
Texture2D crossfadeTexture
 
Vector2 perspectiveOffset = new Vector2 (0f, 0f)
 
float fadeDuration
 
int drawDepth = -1000
 
float alpha = 0f
 
FadeType fadeType
 
CameraFadePauseBehaviour cameraFadePauseBehaviour = CameraFadePauseBehaviour.Cancel
 
AnimationCurve fadeCurve
 
GameCameraData currentFrameCameraData
 
MoveMethod moveMethod
 
float transitionDuration
 
AnimationCurve timeCurve
 
_Camera previousAttachedCamera = null
 
GameCameraData oldCameraData
 
bool retainPreviousSpeed = false
 
Texture2D actualFadeTexture = null
 
float shakeStartTime
 
float shakeDuration
 
float shakeStartIntensity
 
CameraShakeEffect shakeEffect
 
float shakeIntensity
 
Vector3 shakePosition
 
Vector3 shakeRotation
 
AnimationCurve shakeCurve
 
Camera borderCam
 
float borderWidth
 
MenuOrientation borderOrientation
 
Rect borderRect1 = new Rect (0f, 0f, 0f, 0f)
 
Rect borderRect2 = new Rect (0f, 0f, 0f, 0f)
 
Rect midBorderRect = new Rect (0f, 0f, 0f, 0f)
 
Vector2 aspectRatioScaleCorrection = Vector2.zero
 
Vector2 aspectRatioOffsetCorrection = Vector2.zero
 
bool isSplitScreen
 
bool isTopLeftSplit
 
CameraSplitOrientation splitOrientation
 
_Camera splitCamera
 
float splitAmountMain = 0.49f
 
float splitAmountOther = 0.49f
 
float focalDistance = 10f
 
Camera ownCamera
 
AudioListener _audioListener
 
bool timelineOverride
 
bool timelineFadeOverride
 
Texture2D timelineFadeTexture
 
float timelineFadeWeight
 
Rect safeScreenRectInverted
 
Rect playableScreenRect
 
Rect playableScreenRectRelative
 
Rect playableScreenRectInverted
 
Rect playableScreenRectRelativeInverted
 
float playableScreenDiagonalLength
 
int overlayFrames
 

Properties

Camera Camera [get]
 
_Camera attachedCamera [get]
 
AudioListener AudioListener [get]
 
float PlayableScreenDiagonalLength [get]
 
GameCameraData CurrentFrameCameraData [get]
 

Detailed Description

This is attached to the scene's Main Camera, and must be tagged as "MainCamera". The camera system works by having the MainCamera attach itself to the "active" _Camera component. Each _Camera component is merely used for reference - only the MainCamera actually performs any rendering. Shake code adapted from Mike Jasper's code: http://www.mikedoesweb.com/2012/camera-shake-in-unity/ Aspect-ratio code adapated from Eric Haines' code: http://wiki.unity3d.com/index.php?title=AspectRatioEnforcer

Member Function Documentation

◆ _LateUpdate()

void AC.MainCamera._LateUpdate ( )

Updates the Camera's position. This is called every frame by StateHandler.

◆ ConvertRelativeScreenSpaceToUI()

Vector2 AC.MainCamera.ConvertRelativeScreenSpaceToUI ( Vector2  point)

Converts a screen-space position (relative to the screen's actual size) into one in the same co-ordinate system that Unity UI uses.

Parameters
pointThe position to convert
Returns
The position, converted to use the same co-ordinate system as Unity UI.

◆ ConvertToMenuSpace()

Vector2 AC.MainCamera.ConvertToMenuSpace ( Vector2  point)

Converts a screen-space position (e.g. the cursor position) into one in the same co-ordinate system as the AC menu system.

Parameters
pointThe position to convert
Returns
The position, converted to use the same co-ordinate system as the AC menu system. This will be relative to the screen's actual size.

◆ CorrectScreenPositionForUnityUI()

Vector2 AC.MainCamera.CorrectScreenPositionForUnityUI ( Vector2  screenPosition)

Corrects a screen position Vector to account for the MainCamera's viewport Rect. This is necessary when positioning Unity UI RectTransforms while an aspect ratio is enforced, because the original screen position assumes a default Rect.

Parameters
screenPositionThe screen position to correct.
Returns
The corrected screen position

◆ Crossfade()

void AC.MainCamera.Crossfade ( float  _transitionDuration,
_Camera  _linkedCamera,
AnimationCurve  _fadeCurve 
)

Crossfades to a new _Camera over time.

Parameters
_transitionDurationThe duration, in seconds, of the crossfade
_linkedCameraThe _Camera to crossfade to
_fadeCurveAn animation curve used to set the transition behaviour over time

◆ Disable()

void AC.MainCamera.Disable ( )

Disables the Camera and AudioListener.

◆ DrawBorders()

void AC.MainCamera.DrawBorders ( )

Draws any borders generated by a fixed aspect ratio, as set with forceAspectRatio in SettingsManager. This will be called every OnGUI call by StateHandler.

◆ DrawCameraFade()

void AC.MainCamera.DrawCameraFade ( )

Draws the Camera's fade texture. This is called every OnGUI call by StateHandler.

◆ DrawStatus()

void AC.MainCamera.DrawStatus ( )

Displays information about the MainCamera section of the 'AC Status' box.

◆ Enable()

void AC.MainCamera.Enable ( )

Enables the Camera and AudioListener.

◆ FadeIn()

virtual void AC.MainCamera.FadeIn ( float  _fadeDuration,
bool  forceCompleteTransition = true,
CameraFadePauseBehaviour  _cameraFadePauseBehaviour = CameraFadePauseBehaviour.Cancel,
AnimationCurve  _fadeCurve = null 
)
virtual

Fades the camera in.

Parameters
_fadeDurationThe duration, in seconds, of the fade effect
forceCompleteTransitionIf True, the camera will be faded out instantly before beginning
cameraFadePauseBehaviourHow to react to the game being paused (Cancel, Hide, Continue)
  • Parameters
    _fadeCurveAn animation curve used to describe the progress of the fade effect over time. The curve will be processed in normalised time - the _fadeDuration parameter is still used to determine the fade's duration

◆ FadeOut() [1/2]

virtual void AC.MainCamera.FadeOut ( float  _fadeDuration,
bool  forceCompleteTransition = true,
CameraFadePauseBehaviour  _cameraFadePauseBehaviour = CameraFadePauseBehaviour.Cancel,
AnimationCurve  _fadeCurve = null 
)
virtual

Fades the camera out.

Parameters
_fadeDurationThe duration, in seconds, of the fade effect
forceCompleteTransitionIf True, the camera will be faded in instantly before beginning
cameraFadePauseBehaviourHow to react to the game being paused (Cancel, Hide, Continue)
  • Parameters
    _fadeCurveAn animation curve used to describe the progress of the fade effect over time. The curve will be processed in normalised time - the _fadeDuration parameter is still used to determine the fade's duration

◆ FadeOut() [2/2]

void AC.MainCamera.FadeOut ( float  _fadeDuration,
Texture2D  tempTex,
bool  forceCompleteTransition = true,
CameraFadePauseBehaviour  _cameraFadePauseBehaviour = CameraFadePauseBehaviour.Cancel,
AnimationCurve  _fadeCurve = null 
)

Fades the camera out with a custom texture.

Parameters
_fadeDurationThe duration, in seconds, of the fade effect
tempTexThe texture to display full-screen
forceCompleteTransitionIf True, the camera will be faded in instantly before beginning
cameraFadePauseBehaviourHow to react to the game being paused (Cancel, Hide, Continue)
_fadeCurveAn animation curve used to describe the progress of the fade effect over time. The curve will be processed in normalised time - the _fadeDuration parameter is still used to determine the fade's duration

◆ ForceOverlayForFrames()

void AC.MainCamera.ForceOverlayForFrames ( int  numFrames)

Forces an overlay for a number of frames. This is used to mask loading and intialisation, and the game will considered a 'cutscene' during this time.

Parameters
numFramesThe number of frames to enforce the overlay for. This is frame-rate independent, so it will still apply while the game is paused.

◆ ForwardVector()

Vector3 AC.MainCamera.ForwardVector ( )

Gets the Camera's forward vector, not accounting for pitch.

Returns
The Camera's forward vector, not accounting for pitch

◆ GetFadeAlpha()

float AC.MainCamera.GetFadeAlpha ( )

The alpha value of the current fade effect (0 = not visible, 1 = fully visible)

◆ GetFadeTexture()

Texture2D AC.MainCamera.GetFadeTexture ( )

The texture to display full-screen for the fade effect

◆ GetFocalDistance()

float AC.MainCamera.GetFocalDistance ( )

Gets the current focal distance.

Returns
The current focal distance

◆ GetLastGameplayCamera()

_Camera AC.MainCamera.GetLastGameplayCamera ( )

Gets the previously-used gameplay _Camera.

Returns
The previously-used gameplay _Camera

◆ GetPerspectiveOffset()

Vector2 AC.MainCamera.GetPerspectiveOffset ( )

Gets the current perspective offset, as set by a GameCamera2D.

Returns
The current perspective offset, as set by a GameCamera2D.

◆ GetPlayableScreenArea()

Rect AC.MainCamera.GetPlayableScreenArea ( bool  relativeToScreenSize,
bool  invertY = false 
)

Gets a Rect that describes the area of the screen that the game is played in. This accounts both for the "safe" area of the screen, as well as borders added to due an enforced aspect ratio.

Parameters
relativeToScreenSizeIf True, the returned Rect will be scaled relative to the screen's size
invertYIf True, the Rect will be flipped along the Y-axis
Returns
The Rect that describes the area of the screen that the game is played in.

◆ GetSplitScreenRect()

Rect AC.MainCamera.GetSplitScreenRect ( bool  isMainCamera)

Gets a screen Rect of the split-screen camera.

Parameters
isMainCameraIf True, then the Rect of the MainCamera's view will be returned. Otherwise, the Rect of the other split-screen _Camera's view will be returned
Returns
A screen Rect of the split-screen camera

◆ GetTransitionFromCamera()

_Camera AC.MainCamera.GetTransitionFromCamera ( )

Gets the _Camera being transitioned from, if the MainCamera is transitioning between two _Cameras.

Returns
The _Camera being transitioned from, if the MainCamera is transitioning between two _Cameras.

◆ GetWindowViewportDifference()

Vector2 AC.MainCamera.GetWindowViewportDifference ( )

Gets the difference between the window size and the game's viewport.

Returns
The difference between the window size and the game's viewport.

◆ IsEnabled()

bool AC.MainCamera.IsEnabled ( )

Checks if the Camera is enabled.

returns>True if the Camera is enabled

◆ isFading()

virtual bool AC.MainCamera.isFading ( )
virtual

Checks if the Camera is fading in our out.

Returns
True if the Camera is fading in or out

◆ IsInTransition()

bool AC.MainCamera.IsInTransition ( )

Checks if the camera is currently mid-transition between two GameCameras

◆ IsOrthographic()

bool AC.MainCamera.IsOrthographic ( )

Checks if the Camera uses orthographic perspective.

Returns
True if the Camera uses orthographic perspective

◆ IsPointInCamera()

bool AC.MainCamera.IsPointInCamera ( Vector2  point)

Checks if a point in screen-space is within the Camera's viewport

Parameters
pointThe point to check the position of
Returns
True if the point is within the Camera's viewport

◆ IsShaking()

bool AC.MainCamera.IsShaking ( )

Checks if the Camera is shaking.

Returns
True if the Camera is shaking

◆ IsShowingForcedOverlay()

bool AC.MainCamera.IsShowingForcedOverlay ( )

Checks if an overlay is being enforced via a ForceOverlayForFrames call

Returns
True if an overlay is being enforced

>

◆ LimitMenuToAspect()

Rect AC.MainCamera.LimitMenuToAspect ( Rect  rect)

Resizes an OnGUI Rect so that it fits within the Camera's rect, if forceAspectRatio = True in SettingsManager.

Parameters
rectThe OnGUI Rect to resize
Returns
The resized OnGUI Rect

◆ LimitToAspect()

Vector2 AC.MainCamera.LimitToAspect ( Vector2  position)

Limits a point in screen-space to stay within the Camera's rect boundary, if forceAspectRatio in SettingsManager = True.

Parameters
positionThe original position in screen-space
Returns
The point, repositioned to stay within the Camera's rect boundary

◆ LoadData()

void AC.MainCamera.LoadData ( PlayerData  playerData,
bool  snapCamera = true 
)

Restores the camera state from saved data

Parameters
playerDataThe data class to load from
snapCameraIf True, the active camera will be snapped to

◆ PositionRelativeToCamera()

Vector3 AC.MainCamera.PositionRelativeToCamera ( Vector3  _position)

Converts a point in world space to one relative to the Camera's forward vector.

Returns
A point in world space to one relative to the Camera's forward vector.

◆ PrepareForBackground()

virtual void AC.MainCamera.PrepareForBackground ( )
virtual

Prepares the Camera for being able to render a BackgroundImage underneath scene objects.

◆ ReleaseTimelineOverride()

void AC.MainCamera.ReleaseTimelineOverride ( )

Ends Timeline's overriding of normal behaviour, so that the Main Camera resumes normal behaviour.

◆ RemoveSplitScreen()

void AC.MainCamera.RemoveSplitScreen ( )

Ends any active split-screen effect.

◆ ResetMoving()

void AC.MainCamera.ResetMoving ( )

Resets the transition effect when moving from one _Camera to another.

◆ ResetProjection()

void AC.MainCamera.ResetProjection ( )

Resets the Camera's projection matrix.

◆ RightVector()

Vector3 AC.MainCamera.RightVector ( )

Gets the Camera's right vector.

Returns
The Camera's right vector

◆ SaveData()

PlayerData AC.MainCamera.SaveData ( PlayerData  playerData)

Saves data related to the camera.

Parameters
playerDataThe PlayerData class to update with current data
Returns
A PlayerData class, updated with current camera data

◆ SetAudioState()

void AC.MainCamera.SetAudioState ( bool  state)

Sets the state of the AudioListener component.

Parameters
stateIf True, the AudioListener will be enabled. If False, it will be disabled.

◆ SetBoxOverlay()

void AC.MainCamera.SetBoxOverlay ( _Camera  underlayCamera,
_Camera  overlayCamera,
Rect  _overlayRect,
bool  useRectCentre = true 
)

Create a new box-overlay effect

Parameters
underlayCameraThe full-screen camera to go underneath the overlay
overlayCameraThe camera to overlay
_overlayRectA Rect that describes the position and size of the overlay effect

◆ SetCameraRect()

void AC.MainCamera.SetCameraRect ( )

Updates the camera's rect values according to the aspect ratio and split-screen settings.

◆ SetCameraTag()

void AC.MainCamera.SetCameraTag ( string  _tag)

Sets the GameObject's tag.

Parameters
_tagThe tag to give the GameObject

◆ SetDefaultFadeTexture()

void AC.MainCamera.SetDefaultFadeTexture ( Texture2D  _fadeTexture)

Sets the camera's default fade texture, which is used when not temporarily set to something else.

Parameters
_fadeTextureThe new fadeTexture to use, if not null

◆ SetFadeTexture()

void AC.MainCamera.SetFadeTexture ( Texture2D  tex)

Sets the MainCamera's fade texture

Parameters
texThe MainCamera's new fade Texture

◆ SetFirstPerson()

void AC.MainCamera.SetFirstPerson ( )

Activates the FirstPersonCamera found in the Player prefab.

◆ SetGameCamera()

void AC.MainCamera.SetGameCamera ( _Camera  newCamera,
float  transitionTime = 0f,
MoveMethod  _moveMethod = MoveMethod.Linear,
AnimationCurve  _animationCurve = null,
bool  _retainPreviousSpeed = false,
bool  snapCamera = true 
)

Sets a _Camera as the new attachedCamera to follow.

Parameters
newCameraThe new _Camera to follow
transitionTimeThe time, in seconds, that it will take to move towards the new _Camera
_moveMethodHow the Camera should move towards the new _Camera, if transitionTime > 0f (Linear, Smooth, Curved, EaseIn, EaseOut, CustomCurve)
_animationCurveThe AnimationCurve that dictates movement over time, if _moveMethod = MoveMethod.CustomCurve
_retainPreviousSpeedIf True, and transitionTime > 0, then the previous _Camera's speed will influence the transition, allowing for a smoother effect
snapCameraIf True, the new camera will snap to its target position instantly

◆ SetSplitScreen()

void AC.MainCamera.SetSplitScreen ( _Camera  _camera1,
_Camera  _camera2,
CameraSplitOrientation  _splitOrientation,
bool  _isTopLeft,
float  _splitAmountMain,
float  _splitAmountOther 
)

Creates a new split-screen effect.

Parameters
_camera1The first _Camera to use in the effect
_camera2The second _Camera to use in the effect
_splitOrientationHow the two _Cameras are arranged (Horizontal, Vertical)
_isTopLeftIf True, the MainCamera will take the position of _camera1
_splitAmountMainThe proportion of the screen taken up by this Camera
_splitAmountOtherThe proportion of the screen take up by the other _Camera

◆ SetTimelineOverride()

void AC.MainCamera.SetTimelineOverride ( _Camera  cam1,
_Camera  cam2,
float  cam2Weight,
float  _shakeIntensity = 0f 
)

Overrides the MainCamera's normal behaviour, using Timeline to control it.

Parameters
cam1The first AC camera in the Timeline track mix
cam2The second AC camera in the Timeline track mix
cam2WeightThe weight of the second AC camera in the Timeline track mix
shakeIntensityThe intensity of a camera shaking effect

◆ Shake()

void AC.MainCamera.Shake ( float  _shakeIntensity,
float  _duration,
CameraShakeEffect  _shakeEffect,
AnimationCurve  _shakeCurve = null 
)

Shakes the Camera, creating an "earthquake" effect.

Parameters
_shakeIntensityThe shake intensity
_durationThe duration of the effect, in sectonds
_shakeEffectThe type of shaking to make (Translate, Rotate, TranslateAndRotate)

◆ SnapToAttached()

void AC.MainCamera.SnapToAttached ( )

Snaps the Camera to the attachedCamera instantly.

◆ StartSplitScreen()

void AC.MainCamera.StartSplitScreen ( float  _splitAmountMain,
float  _splitAmountOther 
)

Adjusts the screen ratio of any active split-screen effect.

Parameters
_splitAmountMainThe proportion of the screen taken up by this Camera
_splitAmountOtherThe proportion of the screen take up by the other _Camera

◆ StopCrossfade()

void AC.MainCamera.StopCrossfade ( )

Instantly ends the crossfade effect.

◆ StopShaking()

void AC.MainCamera.StopShaking ( )

Ends the "earthquake" shake effect.

◆ TakeOverlayScreenshot()

void AC.MainCamera.TakeOverlayScreenshot ( )

Places a full-screen texture of the current game window over the screen, allowing for a scene change to have no visible transition.

Member Data Documentation

◆ forwardDirection

MainCameraForwardDirection AC.MainCamera.forwardDirection = MainCameraForwardDirection.MainCameraComponent

How the MainCamera's "forward" direction is calculated, which is used for various camera and movement behaviours

◆ lastNavCamera

_Camera AC.MainCamera.lastNavCamera

The last active camera during gameplay

◆ renderFading

bool AC.MainCamera.renderFading = true
protected

If True, the fade texture will be rendered on the script automatically. If False, the user can read this script's GetFadeTexture and GetFadeAlpha values to render it with a custom technique.

Property Documentation

◆ attachedCamera

_Camera AC.MainCamera.attachedCamera
get

The current active camera, i.e. the one that the MainCamera is attaching itself to

◆ Camera

Camera AC.MainCamera.Camera
get

The MainCamera's Camera component.

◆ CurrentFrameCameraData

GameCameraData AC.MainCamera.CurrentFrameCameraData
get

Data related to the MainCamera's currently-active camera and transition

◆ PlayableScreenDiagonalLength

float AC.MainCamera.PlayableScreenDiagonalLength
get

The distance between opposing corners of the playable screen area