Adventure Creator  1.57
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2017
AC.SceneChanger Class Reference
Inheritance diagram for AC.SceneChanger:

Public Member Functions

void OnAwake ()
 
void AfterLoad ()
 
void SetRelativePosition (Transform markerTransform)
 Calculates the player's position relative to the next scene's PlayerStart. More...
 
Vector3 GetStartPosition (Vector3 playerStartPosition)
 Gets the player's starting position by adding the relative position (set in ActionScene) to the PlayerStart's position. More...
 
float GetLoadingProgress ()
 Gets the progress of an asynchronous scene load as a decimal. More...
 
bool IsLoading ()
 
void PreloadScene (SceneInfo nextSceneInfo)
 
void ChangeScene (SceneInfo nextSceneInfo, bool saveRoomData, bool forceReload=false)
 Loads a new scene. More...
 
void LoadPreviousScene ()
 Loads the previously-entered scene.
 
Player GetPlayerOnTransition ()
 Gets the Player prefab that was active during the last scene transition. More...
 
void DestroyOldPlayer ()
 
void SetTransitionTexture (Texture2D _texture)
 
Texture2D GetAndResetTransitionTexture ()
 Gets, and removes from memory, the texture used as an overlay during a scene transition. More...
 
void ScheduleForDeletion (GameObject _gameObject)
 Deletes a GameObject once the current frame has finished renderering. More...
 
bool AddSubScene (SceneInfo sceneInfo)
 Adds a new scene as a sub-scene, without affecting any other open scenes. More...
 
void RegisterSubScene (SubScene subScene)
 Registers a SubScene component with the SceneChanger. More...
 
SubScene[] GetSubScenes ()
 Gets an array of all open SubScenes. More...
 
bool RemoveScene (SceneInfo sceneInfo)
 Removes a scene, without affecting any other open scenes, provided multiple scenes are open. If the active scene is removed, the last-added sub-scene will become the new active scene. More...
 
PlayerData SavePlayerData (PlayerData playerData)
 Saves data used by this script in a PlayerData class. More...
 
void LoadPlayerData (PlayerData playerData)
 Loads data used by this script from a PlayerData class. More...
 

Public Attributes

SceneInfo previousSceneInfo
 

Detailed Description

Handles the changing of the scene, and keeps track of which scene was previously loaded. It should be placed on the PersistentEngine prefab.

Member Function Documentation

bool AC.SceneChanger.AddSubScene ( SceneInfo  sceneInfo)

Adds a new scene as a sub-scene, without affecting any other open scenes.

SUB-SCENES

Parameters
sceneInfoThe SceneInfo of the new scene to open
void AC.SceneChanger.AfterLoad ( )

Called after a scene change.

void AC.SceneChanger.ChangeScene ( SceneInfo  nextSceneInfo,
bool  saveRoomData,
bool  forceReload = false 
)

Loads a new scene.

Parameters
nextSceneInfoInfo about the scene to load
sceneNumberThe number of the scene to load, if sceneName = ""
saveRoomDataIf True, then the states of the current scene's Remember scripts will be recorded in LevelStorage
forceReloadIf True, the scene will be re-loaded if it is already open.
void AC.SceneChanger.DestroyOldPlayer ( )

Destroys the Player prefab that was active during the last scene transition.

Texture2D AC.SceneChanger.GetAndResetTransitionTexture ( )

Gets, and removes from memory, the texture used as an overlay during a scene transition.

Returns
The texture used as an overlay during a scene transition
float AC.SceneChanger.GetLoadingProgress ( )

Gets the progress of an asynchronous scene load as a decimal.

Returns
The progress of an asynchronous scene load as a decimal.
Player AC.SceneChanger.GetPlayerOnTransition ( )

Gets the Player prefab that was active during the last scene transition.

Returns
The Player prefab that was active during the last scene transition
Vector3 AC.SceneChanger.GetStartPosition ( Vector3  playerStartPosition)

Gets the player's starting position by adding the relative position (set in ActionScene) to the PlayerStart's position.

Parameters
playerStartPositionThe position of the PlayerStart object
Returns
The player's starting position
SubScene [] AC.SceneChanger.GetSubScenes ( )

Gets an array of all open SubScenes.

Returns
An array of all open SubScenes
void AC.SceneChanger.LoadPlayerData ( PlayerData  playerData)

Loads data used by this script from a PlayerData class.

Parameters
playerDataThe PlayerData to load from.
void AC.SceneChanger.RegisterSubScene ( SubScene  subScene)

Registers a SubScene component with the SceneChanger.

Parameters
subSceneThe SubScene component to register
bool AC.SceneChanger.RemoveScene ( SceneInfo  sceneInfo)

Removes a scene, without affecting any other open scenes, provided multiple scenes are open. If the active scene is removed, the last-added sub-scene will become the new active scene.

Parameters
sceneInfoThe SceneInfo of the new scene to remove
PlayerData AC.SceneChanger.SavePlayerData ( PlayerData  playerData)

Saves data used by this script in a PlayerData class.

Parameters
playerDataThe PlayerData to save in.
Returns
The updated PlayerData
void AC.SceneChanger.ScheduleForDeletion ( GameObject  _gameObject)

Deletes a GameObject once the current frame has finished renderering.

Parameters
_gameObjectThe GameObject to delete
void AC.SceneChanger.SetRelativePosition ( Transform  markerTransform)

Calculates the player's position relative to the next scene's PlayerStart.

Parameters
markerTransformThe Transform of the GameObject that marks the position that the player should be placed relative to.

Member Data Documentation

SceneInfo AC.SceneChanger.previousSceneInfo

Info about the previous scene