Adventure Creator 1.84.3
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2024
Loading...
Searching...
No Matches
AC.StateHandler Class Reference
Inheritance diagram for AC.StateHandler:

Public Member Functions

void Initialise (bool rebuildMenus=true)
void _OnGUI ()
void OnInitialiseScene ()
bool ApplicationIsInFocus ()
bool ApplicationIsPaused ()
void Register (KickStarter kickStarter)
void Unregister (KickStarter kickStarter)
bool PlayGlobalOnStart ()
 Runs the ActionListAsset defined in SettingsManager's actionListOnStart when the game begins.
void CanGlobalOnStart ()
void IgnoreNavMeshCollisions ()
void UpdateAllMaxVolumes ()
bool IsInCutscene ()
 Checks if the game is currently in a cutscene, scripted or otherwise.
bool IsPaused ()
 Checks if the game is currently paused.
bool IsInGameplay ()
 Checks if the game is currently in regular gameplay.
void SetACState (bool state)
 Enables or disables Adventure Creator completely.
bool IsACEnabled ()
 Checks if AC is currently enabled.
void SetCursorSystem (bool state)
 Sets the enabled state of the PlayerCursor system.
void SetInputSystem (bool state)
 Sets the enabled state of the PlayerInput system.
void SetInteractionSystem (bool state)
 Sets the enabled state of the Interaction system.
void SetDraggableSystem (bool state)
 Sets the enabled state of the Draggable system.
bool CanInteract ()
 Checks if the interaction system is enabled.
bool CanReceiveInput ()
 Checks if the input system is enabled.
bool CanInteractWithDraggables ()
 Checks if the draggables system is enabled.
void SetMenuSystem (bool state)
 Sets the enabled state of the PlayerMenus system.
void SetMovementSystem (bool state)
 Sets the enabled state of the PlayerMovement system.
void SetCameraSystem (bool state)
 Sets the enabled state of the MainCamera system.
void SetTriggerSystem (bool state)
 Sets the enabled state of the trigger system.
void SetPlayerSystem (bool state)
 Sets the enabled state of the Player system.
bool AreTriggersDisabled ()
 Checks if the trigger system is disabled.
bool AreCamerasDisabled ()
 Checks if the camera system is disabled.
MainData SaveMainData (MainData mainData)
 Updates a MainData class with its own variables that need saving.
void LoadMainData (MainData mainData)
 Updates its own variables from a MainData class.
Music GetMusicEngine ()
 Gets the Music component used to handle AudioClips played using the 'Sound: Play music' Action.
Ambience GetAmbienceEngine ()
 Gets the Ambience component used to handle AudioClips played using the 'Sound: Play ambience' Action.
void RegisterInitialConstantIDs ()
void Register (ArrowPrompt _object)
 Registers an ArrowPrompt, so that it can be updated.
void Unregister (ArrowPrompt _object)
 Unregisters an ArrowPrompt, so that it is no longer updated.
void Register (DragBase _object)
 Registers a DragBase, so that it can be updated.
void Unregister (DragBase _object)
 Unregisters a DragBase, so that it is no longer updated.
void Register (Parallax2D _object)
 Registers a Parallax2D, so that it can be updated.
void Unregister (Parallax2D _object)
 Unregisters a Parallax2D, so that it is no longer updated.
void Register (Hotspot _object)
 Registers a Hotspot, so that it can be updated.
void Unregister (Hotspot _object)
 Unregisters a Hotspot, so that it is no longer updated.
void Register (Highlight _object)
 Registers a Highlight, so that it can be updated.
void Unregister (Highlight _object)
 Unregisters a Highlight, so that it is no longer updated.
void Register (AC_Trigger _object)
 Registers a AC_Trigger, so that it can be updated.
void Unregister (AC_Trigger _object)
 Unregisters a AC_Trigger, so that it is no longer updated.
void Register (_Camera _object)
 Registers a _Camera, so that it can be updated.
void Unregister (_Camera _object)
 Unregisters a _Camera, so that it is no longer updated.
void Register (Sound _object)
 Registers a Sound, so that it can be updated.
void Unregister (Sound _object)
 Unregisters a Sound, so that it is no longer updated.
void Register (Char _object)
 Registers a Char, so that it can be updated.
void Unregister (Char _object)
 Unregisters a Char, so that it is no longer updated.
void Register (FollowSortingMap _object)
 Registers a FollowSortingMap, so that it can be updated.
void Unregister (FollowSortingMap _object)
 Unregisters a FollowSortingMap, so that it is no longer updated.
void Register (NavMeshBase _object)
 Registers a NavMeshBase, so that it can be updated.
void Unregister (NavMeshBase _object)
 Unregisters a NavMeshBase, so that it is no longer updated.
void Register (SortingMap _object)
 Registers a SortingMap, so that it can be updated.
void Unregister (SortingMap _object)
 Unregisters a SortingMap, so that it is no longer updated.
void Register (BackgroundCamera _object)
 Registers a BackgroundCamera, so that it can be updated.
void Unregister (BackgroundCamera _object)
 Unregisters a BackgroundCamera, so that it is no longer updated.
void Register (BackgroundImage _object)
 Registers a BackgroundImage, so that it can be updated.
void Unregister (BackgroundImage _object)
 Unregisters a BackgroundImage, so that it is no longer updated.
void Register (Container _object)
 Registers a Container, so that it can be updated.
void Unregister (Container _object)
 Unregisters a Container, so that it is no longer updated.
void Register (ConstantID _object)
 Registers a ConstantID, so that it can be updated.
void Unregister (ConstantID _object)
 Unregisters a ConstantID, so that it is no longer updated.

Public Attributes

readonly HashSet< CharCharacters = new HashSet<Char> ()
readonly HashSet< PlayerPlayers = new HashSet<Player> ()
readonly HashSet< SoundSounds = new HashSet<Sound> ()
readonly HashSet< ConstantIDConstantIDs = new HashSet<ConstantID> ()
readonly HashSet< HotspotHotspots = new HashSet<Hotspot> ()
readonly HashSet< FollowSortingMapFollowSortingMaps = new HashSet<FollowSortingMap> ()
readonly HashSet< SortingMapSortingMaps = new HashSet<SortingMap> ()
readonly HashSet< BackgroundCameraBackgroundCameras = new HashSet<BackgroundCamera> ()
readonly HashSet< BackgroundImageBackgroundImages = new HashSet<BackgroundImage> ()
readonly HashSet< ContainerContainers = new HashSet<Container> ()
readonly HashSet< _CameraCameras = new HashSet<_Camera> ()
readonly ConstantIDManager ConstantIDManager = new ConstantIDManager ()

Protected Member Functions

void Update ()
void LateUpdate ()
void FixedUpdate ()
void OnGUI ()
void OnAddSubScene (SubScene subScene)
void OnEnterGameState (GameState gameState)
void CreateMusicEngine ()
void CreateAmbienceEngine ()
bool CanRun ()
void OnPauseStateChange (UnityEditor.PauseState state)

Protected Attributes

Music music
Ambience ambience
bool inScriptedCutscene
bool inScriptedPause
GameState previousUpdateState = GameState.Normal
bool isACDisabled = false
bool cursorIsOff = false
bool inputIsOff = false
bool interactionIsOff = false
bool draggablesIsOff = false
bool menuIsOff = false
bool cameraIsOff = false
bool triggerIsOff = false
bool playerIsOff = false
bool applicationIsInFocus = true
bool applicationIsPaused = false
bool runAtLeastOnce = false
KickStarter activeKickStarter = null

Properties

bool MovementIsOff [get]
GameState gameState [get]
bool EnforceCutsceneMode [get, set]
bool EnforcePauseMode [get, set]
bool CursorSystemIsEnabled [get]
bool InputSystemIsEnabled [get]
bool InteractionSystemIsEnabled [get]
bool DraggableSystemIsEnabled [get]
bool MenuSystemIsEnabled [get]
bool MovementSystemIsEnabled [get]
bool CameraSystemIsEnabled [get]
bool TriggerSystemIsEnabled [get]
bool PlayerSystemIsEnabled [get]

Detailed Description

This script stores the all-important gameState variable, which determines if the game is running normal gameplay, is in a cutscene, or is paused. It also runs the various "Update", "LateUpdate", "FixedUpdate" and "OnGUI" functions that are within Adventure Creator's main scripts - by running them all from here, performance is drastically improved.

Member Function Documentation

◆ _OnGUI()

void AC.StateHandler._OnGUI ( )

Runs all of AC's OnGUI code. This is called automatically from within StateHandler, unless 'ACIgnoreOnGUI' is listed in Unity's Scripting Define Symbols box in the Player settings.

◆ ApplicationIsInFocus()

bool AC.StateHandler.ApplicationIsInFocus ( )

Checks if the application is currently in focus or not

◆ ApplicationIsPaused()

bool AC.StateHandler.ApplicationIsPaused ( )

Checks if the application is currently paused

◆ AreCamerasDisabled()

bool AC.StateHandler.AreCamerasDisabled ( )

Checks if the camera system is disabled.

Returns
True if the camera system is disabled

◆ AreTriggersDisabled()

bool AC.StateHandler.AreTriggersDisabled ( )

Checks if the trigger system is disabled.

Returns
True if the trigger system is disabled

◆ CanGlobalOnStart()

void AC.StateHandler.CanGlobalOnStart ( )

Allows the ActionListAsset defined in SettingsManager's actionListOnStart to be run again.

◆ CanInteract()

bool AC.StateHandler.CanInteract ( )

Checks if the interaction system is enabled.

Returns
True if the interaction system is enabled

◆ CanInteractWithDraggables()

bool AC.StateHandler.CanInteractWithDraggables ( )

Checks if the draggables system is enabled.

Returns
True if the draggables system is enabled

◆ CanReceiveInput()

bool AC.StateHandler.CanReceiveInput ( )

Checks if the input system is enabled.

Returns
True if the input system is enabled

◆ GetAmbienceEngine()

Ambience AC.StateHandler.GetAmbienceEngine ( )

Gets the Ambience component used to handle AudioClips played using the 'Sound: Play ambience' Action.

Returns
The Ambience component used to handle AudioClips played using the 'Sound: Play ambience' Action.

◆ GetMusicEngine()

Music AC.StateHandler.GetMusicEngine ( )

Gets the Music component used to handle AudioClips played using the 'Sound: Play music' Action.

Returns
The Music component used to handle AudioClips played using the 'Sound: Play music' Action.

◆ IgnoreNavMeshCollisions()

void AC.StateHandler.IgnoreNavMeshCollisions ( )

Calls Physics.IgnoreCollision on all appropriate Collider combinations (Unity 5 only).

◆ IsACEnabled()

bool AC.StateHandler.IsACEnabled ( )

Checks if AC is currently enabled.

Returns
Trye if AC is currently enabled.
Returns

◆ IsInCutscene()

bool AC.StateHandler.IsInCutscene ( )

Checks if the game is currently in a cutscene, scripted or otherwise.

Returns
True if the game is currently in a cutscene

◆ IsInGameplay()

bool AC.StateHandler.IsInGameplay ( )

Checks if the game is currently in regular gameplay.

Returns
True if the game is currently in regular gameplay

◆ IsPaused()

bool AC.StateHandler.IsPaused ( )

Checks if the game is currently paused.

Returns
True if the game is currently paused

◆ LoadMainData()

void AC.StateHandler.LoadMainData ( MainData mainData)

Updates its own variables from a MainData class.

Parameters
mainDataThe MainData class to load from

◆ PlayGlobalOnStart()

bool AC.StateHandler.PlayGlobalOnStart ( )

Runs the ActionListAsset defined in SettingsManager's actionListOnStart when the game begins.

Returns
True if an ActionListAsset was run

◆ Register() [1/17]

void AC.StateHandler.Register ( _Camera _object)

Registers a _Camera, so that it can be updated.

Parameters
_objectThe _Camera to register

◆ Register() [2/17]

void AC.StateHandler.Register ( AC_Trigger _object)

Registers a AC_Trigger, so that it can be updated.

Parameters
_objectThe AC_Trigger to register

◆ Register() [3/17]

void AC.StateHandler.Register ( ArrowPrompt _object)

Registers an ArrowPrompt, so that it can be updated.

Parameters
_objectThe ArrowPrompt to register

◆ Register() [4/17]

void AC.StateHandler.Register ( BackgroundCamera _object)

Registers a BackgroundCamera, so that it can be updated.

Parameters
_objectThe BackgroundCamera to register

◆ Register() [5/17]

void AC.StateHandler.Register ( BackgroundImage _object)

Registers a BackgroundImage, so that it can be updated.

Parameters
_objectThe BackgroundImage to register

◆ Register() [6/17]

void AC.StateHandler.Register ( Char _object)

Registers a Char, so that it can be updated.

Parameters
_objectThe Char to register

◆ Register() [7/17]

void AC.StateHandler.Register ( ConstantID _object)

Registers a ConstantID, so that it can be updated.

Parameters
_objectThe ConstantID to register

◆ Register() [8/17]

void AC.StateHandler.Register ( Container _object)

Registers a Container, so that it can be updated.

Parameters
_objectThe Container to register

◆ Register() [9/17]

void AC.StateHandler.Register ( DragBase _object)

Registers a DragBase, so that it can be updated.

Parameters
_objectThe DragBase to register

◆ Register() [10/17]

void AC.StateHandler.Register ( FollowSortingMap _object)

Registers a FollowSortingMap, so that it can be updated.

Parameters
_objectThe FollowSortingMap to register

◆ Register() [11/17]

void AC.StateHandler.Register ( Highlight _object)

Registers a Highlight, so that it can be updated.

Parameters
_objectThe Highlight to register

◆ Register() [12/17]

void AC.StateHandler.Register ( Hotspot _object)

Registers a Hotspot, so that it can be updated.

Parameters
_objectThe Hotspot to register

◆ Register() [13/17]

void AC.StateHandler.Register ( KickStarter kickStarter)

Alerts the StateHandler that a Game Engine prefab is present in the scene. This is called from KickStarter when the game begins - the StateHandler will not run until this is done.

◆ Register() [14/17]

void AC.StateHandler.Register ( NavMeshBase _object)

Registers a NavMeshBase, so that it can be updated.

Parameters
_objectThe NavMeshBase to register

◆ Register() [15/17]

void AC.StateHandler.Register ( Parallax2D _object)

Registers a Parallax2D, so that it can be updated.

Parameters
_objectThe Parallax2D to register

◆ Register() [16/17]

void AC.StateHandler.Register ( SortingMap _object)

Registers a SortingMap, so that it can be updated.

Parameters
_objectThe SortingMap to register

◆ Register() [17/17]

void AC.StateHandler.Register ( Sound _object)

Registers a Sound, so that it can be updated.

Parameters
_objectThe Sound to register

◆ RegisterInitialConstantIDs()

void AC.StateHandler.RegisterInitialConstantIDs ( )

Creates an initial record of all ConstantID components in the Hierarchy. More may be added through OnEnable / Start functions, but this way those that are initially present are ensured to be included in initialisation processes

◆ SaveMainData()

MainData AC.StateHandler.SaveMainData ( MainData mainData)

Updates a MainData class with its own variables that need saving.

Parameters
mainDataThe original MainData class
Returns
The updated MainData class

◆ SetACState()

void AC.StateHandler.SetACState ( bool state)

Enables or disables Adventure Creator completely.

Parameters
stateIf True, then Adventure Creator will be enabled. If False, then Adventure Creator will be disabled.

◆ SetCameraSystem()

void AC.StateHandler.SetCameraSystem ( bool state)

Sets the enabled state of the MainCamera system.

Parameters
stateIf True, the MainCamera system will be enabled

◆ SetCursorSystem()

void AC.StateHandler.SetCursorSystem ( bool state)

Sets the enabled state of the PlayerCursor system.

Parameters
stateIf True, the PlayerCursor system will be enabled

◆ SetDraggableSystem()

void AC.StateHandler.SetDraggableSystem ( bool state)

Sets the enabled state of the Draggable system.

Parameters
stateIf True, the Draggable system will be enabled

◆ SetInputSystem()

void AC.StateHandler.SetInputSystem ( bool state)

Sets the enabled state of the PlayerInput system.

Parameters
stateIf True, the PlayerInput system will be enabled

◆ SetInteractionSystem()

void AC.StateHandler.SetInteractionSystem ( bool state)

Sets the enabled state of the Interaction system.

Parameters
stateIf True, the Interaction system will be enabled

◆ SetMenuSystem()

void AC.StateHandler.SetMenuSystem ( bool state)

Sets the enabled state of the PlayerMenus system.

Parameters
stateIf True, the PlayerMenus system will be enabled

◆ SetMovementSystem()

void AC.StateHandler.SetMovementSystem ( bool state)

Sets the enabled state of the PlayerMovement system.

Parameters
stateIf True, the PlayerMovement system will be enabled

◆ SetPlayerSystem()

void AC.StateHandler.SetPlayerSystem ( bool state)

Sets the enabled state of the Player system.

Parameters
stateIf True, the Player system will be enabled

◆ SetTriggerSystem()

void AC.StateHandler.SetTriggerSystem ( bool state)

Sets the enabled state of the trigger system.

Parameters
stateIf True, the trigger system will be enabled

◆ Unregister() [1/17]

void AC.StateHandler.Unregister ( _Camera _object)

Unregisters a _Camera, so that it is no longer updated.

Parameters
_objectThe _Camera to unregister

◆ Unregister() [2/17]

void AC.StateHandler.Unregister ( AC_Trigger _object)

Unregisters a AC_Trigger, so that it is no longer updated.

Parameters
_objectThe AC_Trigger to unregister

◆ Unregister() [3/17]

void AC.StateHandler.Unregister ( ArrowPrompt _object)

Unregisters an ArrowPrompt, so that it is no longer updated.

Parameters
_objectThe ArrowPrompt to unregister

◆ Unregister() [4/17]

void AC.StateHandler.Unregister ( BackgroundCamera _object)

Unregisters a BackgroundCamera, so that it is no longer updated.

Parameters
_objectThe BackgroundCamera to unregister

◆ Unregister() [5/17]

void AC.StateHandler.Unregister ( BackgroundImage _object)

Unregisters a BackgroundImage, so that it is no longer updated.

Parameters
_objectThe BackgroundImage to unregister

◆ Unregister() [6/17]

void AC.StateHandler.Unregister ( Char _object)

Unregisters a Char, so that it is no longer updated.

Parameters
_objectThe Char to unregister

◆ Unregister() [7/17]

void AC.StateHandler.Unregister ( ConstantID _object)

Unregisters a ConstantID, so that it is no longer updated.

Parameters
_objectThe ConstantID to unregister

◆ Unregister() [8/17]

void AC.StateHandler.Unregister ( Container _object)

Unregisters a Container, so that it is no longer updated.

Parameters
_objectThe Container to unregister

◆ Unregister() [9/17]

void AC.StateHandler.Unregister ( DragBase _object)

Unregisters a DragBase, so that it is no longer updated.

Parameters
_objectThe DragBase to unregister

◆ Unregister() [10/17]

void AC.StateHandler.Unregister ( FollowSortingMap _object)

Unregisters a FollowSortingMap, so that it is no longer updated.

Parameters
_objectThe FollowSortingMap to unregister

◆ Unregister() [11/17]

void AC.StateHandler.Unregister ( Highlight _object)

Unregisters a Highlight, so that it is no longer updated.

Parameters
_objectThe Highlight to unregister

◆ Unregister() [12/17]

void AC.StateHandler.Unregister ( Hotspot _object)

Unregisters a Hotspot, so that it is no longer updated.

Parameters
_objectThe Hotspot to unregister

◆ Unregister() [13/17]

void AC.StateHandler.Unregister ( KickStarter kickStarter)

Alerts the StateHandler that a Game Engine prefab is no longer present in the scene. This is called from KickStarter's OnDestroy function.

◆ Unregister() [14/17]

void AC.StateHandler.Unregister ( NavMeshBase _object)

Unregisters a NavMeshBase, so that it is no longer updated.

Parameters
_objectThe NavMeshBase to unregister

◆ Unregister() [15/17]

void AC.StateHandler.Unregister ( Parallax2D _object)

Unregisters a Parallax2D, so that it is no longer updated.

Parameters
_objectThe Parallax2D to unregister

◆ Unregister() [16/17]

void AC.StateHandler.Unregister ( SortingMap _object)

Unregisters a SortingMap, so that it is no longer updated.

Parameters
_objectThe SortingMap to unregister

◆ Unregister() [17/17]

void AC.StateHandler.Unregister ( Sound _object)

Unregisters a Sound, so that it is no longer updated.

Parameters
_objectThe Sound to unregister

◆ UpdateAllMaxVolumes()

void AC.StateHandler.UpdateAllMaxVolumes ( )

Sets the maximum volume of all Sound objects in the scene.

Member Data Documentation

◆ BackgroundCameras

readonly HashSet<BackgroundCamera> AC.StateHandler.BackgroundCameras = new HashSet<BackgroundCamera> ()

A HashSet of all BackgroundCamera components found in the scene

◆ BackgroundImages

readonly HashSet<BackgroundImage> AC.StateHandler.BackgroundImages = new HashSet<BackgroundImage> ()

A HashSet of all BackgroundImage components found in the scene

◆ Cameras

readonly HashSet<_Camera> AC.StateHandler.Cameras = new HashSet<_Camera> ()

A HashSet of all _Camera components found in the scene

◆ Characters

readonly HashSet<Char> AC.StateHandler.Characters = new HashSet<Char> ()

A HashSet of all Characters found in the scene

◆ ConstantIDManager

readonly ConstantIDManager AC.StateHandler.ConstantIDManager = new ConstantIDManager ()

The ConstantIDManager used to record all ConstantID components in the Hierarchy

◆ ConstantIDs

readonly HashSet<ConstantID> AC.StateHandler.ConstantIDs = new HashSet<ConstantID> ()

A HashSet of all ConstantID components found in the scene

◆ Containers

readonly HashSet<Container> AC.StateHandler.Containers = new HashSet<Container> ()

A HashSet of all Container components found in the scene

◆ FollowSortingMaps

readonly HashSet<FollowSortingMap> AC.StateHandler.FollowSortingMaps = new HashSet<FollowSortingMap> ()

A HashSet of all FollowSortingMap components found in the scene

◆ Hotspots

readonly HashSet<Hotspot> AC.StateHandler.Hotspots = new HashSet<Hotspot> ()

A HashSet of all Hotspot components found in the scene

◆ Players

readonly HashSet<Player> AC.StateHandler.Players = new HashSet<Player> ()

A HashSet of all Players found in the scene

◆ SortingMaps

readonly HashSet<SortingMap> AC.StateHandler.SortingMaps = new HashSet<SortingMap> ()

A HashSet of all SortingMap components found in the scene

◆ Sounds

readonly HashSet<Sound> AC.StateHandler.Sounds = new HashSet<Sound> ()

A HashSet of all Sound components found in the scene

Property Documentation

◆ EnforceCutsceneMode

bool AC.StateHandler.EnforceCutsceneMode
getset

The state of enforced cutscene mode. This is used to block gameplay etc through custom scripting, as opposed to ActionLists

◆ EnforcePauseMode

bool AC.StateHandler.EnforcePauseMode
getset

The state of enforced pause mode. This is used to pause the game without requiring a pausing menu to be enabled

◆ gameState

GameState AC.StateHandler.gameState
get

The current state of the game (Normal, Cutscene, Paused, DialogOptions)

◆ MovementIsOff

bool AC.StateHandler.MovementIsOff
get

True if the Movement system has been disabled