All Classes Namespaces Functions Variables Enumerations Enumerator Properties
plyGame.PlayerManager Class Reference

The player manager is an optional system that can be used when you do not want to manually take care of player character loading and management More...

Inherits MonoBehaviour.

Public Member Functions

void SpawnPlayer (string ident, Transform targetTr)
 Instruct the Player Manager to spawn a Player character in the scene. ident is used to identify this player character uniquely when you may be using more than one in a game session. It defaults to "player" if you pass an empty string. This ident is used when saving/ loading the player data. This call will silently fail if there is already a player character in the scene. If targeTr is set then that transform's location and rotation is used to initialise the character's position and rotation. More...
 
void DestroyPlayer ()
 Instruct the Player Manager to remove the Player character from the scene. More...
 
void SetActivePlayer (int idx)
 Set the active player from the playerCharacters list. More...
 
void SetActivePlayerArt (int idx)
 Set the active player art from the playerCharacters list. The active player must be set first via SetActivePlayer More...
 
GameObject GetPlayerPrefab (int idx)
 Return reference to the Player Prefab from the Player Manager. More...
 
GameObject GetPlayerArtPrefab (int plridx, int idx)
 Return reference to the Player Art Prefab from the Player Manager. More...
 

Public Attributes

GameObject defaultPlayerFab
 The default player prefab is used when the designer uses Unity Play button to test a scene and also when there are no other player prefabs defined. This is the one prefab that should be set if you want the manager active. More...
 
List< PlayerManagerCharacterDataplayerCharacters = new List<PlayerManagerCharacterData>()
 List of player character prefabs More...
 
int defaultCharaIdx = -1
 
int defaultCharaArtIdx = -1
 
plyBlox blox
 plyBlox associated with the player manager. More...
 

Protected Member Functions

void Awake ()
 
void Start ()
 

Properties

static PlayerManager Instance [get, set]
 Instance is set on Awake. Player Manager is auto-created by plyGame when the game starts and at least the defaultPlayerFab is set to a valid prefab. More...
 

Detailed Description

The player manager is an optional system that can be used when you do not want to manually take care of player character loading and management

Member Function Documentation

void plyGame.PlayerManager.DestroyPlayer ( )

Instruct the Player Manager to remove the Player character from the scene.

GameObject plyGame.PlayerManager.GetPlayerArtPrefab ( int  plridx,
int  idx 
)

Return reference to the Player Art Prefab from the Player Manager.

GameObject plyGame.PlayerManager.GetPlayerPrefab ( int  idx)

Return reference to the Player Prefab from the Player Manager.

void plyGame.PlayerManager.SetActivePlayer ( int  idx)

Set the active player from the playerCharacters list.

void plyGame.PlayerManager.SetActivePlayerArt ( int  idx)

Set the active player art from the playerCharacters list. The active player must be set first via SetActivePlayer

void plyGame.PlayerManager.SpawnPlayer ( string  ident,
Transform  targetTr 
)

Instruct the Player Manager to spawn a Player character in the scene. ident is used to identify this player character uniquely when you may be using more than one in a game session. It defaults to "player" if you pass an empty string. This ident is used when saving/ loading the player data. This call will silently fail if there is already a player character in the scene. If targeTr is set then that transform's location and rotation is used to initialise the character's position and rotation.

Member Data Documentation

plyBlox plyGame.PlayerManager.blox

plyBlox associated with the player manager.

GameObject plyGame.PlayerManager.defaultPlayerFab

The default player prefab is used when the designer uses Unity Play button to test a scene and also when there are no other player prefabs defined. This is the one prefab that should be set if you want the manager active.

List<PlayerManagerCharacterData> plyGame.PlayerManager.playerCharacters = new List<PlayerManagerCharacterData>()

List of player character prefabs

Property Documentation

PlayerManager plyGame.PlayerManager.Instance
staticgetset

Instance is set on Awake. Player Manager is auto-created by plyGame when the game starts and at least the defaultPlayerFab is set to a valid prefab.