Adventure Creator  1.76.2
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.PlayerPrefab Class Reference

Public Member Functions

 PlayerPrefab (int[] idArray)
 
Player GetSceneInstance (bool spawnIfNotPresent=false)
 Gets the runtime scene instance of the Player More...
 
void SpawnInScene (bool makeActivePlayer)
 Spawns a new instance of the Player if one is not currently present. More...
 
void SpawnInScene (Scene scene)
 Spawns a new instance of the Player if one is not currently present, and places them in a specific scene. This will not be the active Player. More...
 
void SetInitialPosition (PlayerData playerData)
 
void RemoveFromScene ()
 
void ShowGUI (string apiPrefix)
 
void ShowStartDataGUI (string apiPrefix)
 

Static Public Member Functions

static void FindPlayerReferences (int playerID, string playerName)
 

Public Attributes

Player playerOb
 
int ID
 
bool isDefault
 
int startingSceneIndex = 0
 
ChooseSceneBy chooseSceneBy = ChooseSceneBy.Number
 
string startingSceneName = ""
 
bool useSceneDefaultPlayerStart = true
 
int startingPlayerStartID
 

Detailed Description

A data container for a Player that is spawned automatically at runtime, and whose data is tracked automatically.

Constructor & Destructor Documentation

◆ PlayerPrefab()

AC.PlayerPrefab.PlayerPrefab ( int[]  idArray)

The default Constructor. An array of ID numbers is required, to ensure its own ID is unique.

Member Function Documentation

◆ GetSceneInstance()

Player AC.PlayerPrefab.GetSceneInstance ( bool  spawnIfNotPresent = false)

Gets the runtime scene instance of the Player

Parameters
spawnIfNotPresentIf True, the Player will be spawned if no scene instance was found.
Returns
The scene instance of the Player

◆ RemoveFromScene()

void AC.PlayerPrefab.RemoveFromScene ( )

Removes any runtime instance of the Player from the scene

◆ SpawnInScene() [1/2]

void AC.PlayerPrefab.SpawnInScene ( bool  makeActivePlayer)

Spawns a new instance of the Player if one is not currently present.

Parameters
makeActivePlayerIf True, the Player will be made the active Player afterwards

◆ SpawnInScene() [2/2]

void AC.PlayerPrefab.SpawnInScene ( Scene  scene)

Spawns a new instance of the Player if one is not currently present, and places them in a specific scene. This will not be the active Player.

Parameters
sceneThe scene to place the instance in.

Member Data Documentation

◆ chooseSceneBy

ChooseSceneBy AC.PlayerPrefab.chooseSceneBy = ChooseSceneBy.Number

How to reference the Player's starting scene, if not the default (Name, Number)

◆ ID

int AC.PlayerPrefab.ID

A unique identifier

◆ isDefault

bool AC.PlayerPrefab.isDefault

If True, this Player is the game's default

◆ playerOb

Player AC.PlayerPrefab.playerOb

The Player prefab

◆ startingPlayerStartID

int AC.PlayerPrefab.startingPlayerStartID

The ConstantID value of the PlayerStart to appear at, if not the default Player

◆ startingSceneIndex

int AC.PlayerPrefab.startingSceneIndex = 0

The scene index to start in, if the Player is not the default, and chooseSceneBy = ChooseSceneBy.Number

◆ startingSceneName

string AC.PlayerPrefab.startingSceneName = ""

The name of the scene to start in, if the Player is not the default, and chooseSceneBy = ChooseSceneBy.Name

◆ useSceneDefaultPlayerStart

bool AC.PlayerPrefab.useSceneDefaultPlayerStart = true

If True, then the Player will appear at their initial scene's Default PlayerStart - as opposed to one specified here