![]() |
Platformer Pro
2.3.2
A platform game kit for Unity.
|
The master Game Manager controls loading characters, triggering persistence, and setting up the game ready to play. More...
Public Member Functions | |
override void | Validate (PlatformerProMonoBehaviour myTarget) |
Validate required components. More... | |
void | ForceSave () |
Force all persistables to save. More... | |
Character | GetCharacterForPlayerId (int playerId) |
Gets the character for fiven player identifier. If id = -1 return first active character. Returns null if no character for playerId More... | |
void | SpawnNewCharacter (int playerId, string characterId) |
Spawns a new character. Fails if a character with the supplied player id exists. More... | |
void | ReplaceCharacter (int playerId, string characterId) |
Replace a character with a different one. More... | |
void | SwitchCharacter (int currentPlayerId, int newPlayerId) |
Switches to a new character. Fails if a character with the supplied player id doesn't exist. More... | |
Static Public Member Functions | |
static void | SetCharacterForPlayer (int playerId, string characterId) |
Sets the character to load for a given player; More... | |
static void | UnSetCharacterForPlayer (int playerId) |
UnSets the character to load for a given player; More... | |
Public Attributes | |
List< AvailableCharacterData > | availableCharacters |
List of all available characters. These can be loaded at the start of the game or while the game is in progress. If there is only one character in this list it will be automatically loaded. More... | |
bool | enablePersistence = true |
Should we enable saving and loading? More... | |
bool | useBinaryFormat = true |
Should we save using binary files (true) or XML files (false). More... | |
PersistenceResetType | defaultPersistenceReset |
How do we handle persistence reset? More... | |
bool | saveOnAnyChange |
Will we save always, or only when the cahracter dies or leaves a scene. More... | |
bool | saveOnAnyChangeEditorOnly |
Save always, but only in the editor. More... | |
float | saveRate = 1.0f |
Regardless of how often Save is called, don't save faster than this. More... | |
bool | persistObjectsInLevel |
Should we (by default) persist platformer pro object like doors, platforms, items, etc. You can override on invidiual objects. More... | |
PersistableObjectType | itemPersistenceType = PersistableObjectType.ACTIVATE_DEACTIVATE |
Should we persist item state by default. More... | |
bool | spawnedItemPersistence = false |
Should we persist items spawned in to the scene. More... | |
PersistableEnemyType | enemyPersistenceType = PersistableEnemyType.ALIVE_DEAD |
Should we persist enemy state by default. More... | |
GameOverType | endGameWhen |
When does the game end. More... | |
bool | isMapOrMenu |
Set to true if this is not a normal playable level. More... | |
Static Public Attributes | |
const int | ANY_PLAYER = -1 |
Constant for a player id that matches any player. More... | |
Protected Member Functions | |
virtual void | OnCharacterLoaded (Character character) |
Raises the character loaded event. More... | |
virtual void | OnCharacterRemoved (Character character) |
Raises the character removed event. More... | |
virtual void | OnPhaseChanged (GamePhase phase) |
Raises the phase change event. More... | |
virtual void | Init () |
Initialise this instance. Called form Awake. More... | |
virtual void | PostInit () |
Called from start. Use this to get references, etc. More... | |
virtual void | LoadCharacter () |
Loads the character. More... | |
virtual void | DoLoad () |
Does the load after a delay. More... | |
virtual IEnumerator | PostLoad () |
After start frame tell send events for loaded characters. More... | |
virtual void | LoadCharacter (int playerId, string characterId) |
Loads the character with the given id. More... | |
virtual void | HandleGameOver (object sender, CharacterEventArgs e) |
Handle game over events More... | |
virtual IEnumerator | PostLoad (Character c) |
Send the character loaded event after yielding for a frame. More... | |
Protected Attributes | |
List< Character > | loadedCharacters |
All the loaded characters. More... | |
float | saveTimer |
Track how long until the next save. More... | |
GamePhase | gamePhase |
The game loading phase. More... | |
Static Protected Attributes | |
static bool | initialised |
Tracks if we have initialised an instance of the game manager. More... | |
static List< string > | charactersToLoad |
List of character ids which should be loaded on Start(). One slot per player. If a slot is null tha given player is not playing. More... | |
static PlatformerProGameManager | instance |
Stores the singleton instance. More... | |
Properties | |
override string | Header [get] |
Gets the header string used to describe the component. More... | |
virtual GamePhase | GamePhase [get, protected set] |
Gets or sets the game loading phase and send an event when set. More... | |
virtual List< Character > | LoadedCharacters [get] |
Returns all loaded characters. WARNING: For performance reasons this is not a copy. More... | |
virtual PersistableObjectManager | PersistableObjectManager [get, protected set] |
Gets or sets the persistable object manager. More... | |
static PlatformerProGameManager | Instance [get, protected set] |
Gets a character loader (generally for single character games only). More... | |
![]() | |
virtual string | Header [get] |
Gets the header string used to describe the component. More... | |
virtual string | DocLink [get] |
Gets a link to documentation site. More... | |
virtual string | VideoLink [get] |
Gets a link to a youtube video. More... | |
virtual string | Deprecated [get] |
If non-null this component is deprecated. The string shows a message indicating how it should be replaced. More... | |
Events | |
System.EventHandler< CharacterEventArgs > | CharacterLoaded |
Event fired when a character finishes loading. More... | |
System.EventHandler< CharacterEventArgs > | CharacterRemoved |
Event fired when a character is removed. More... | |
System.EventHandler< GamePhaseEventArgs > | PhaseChanged |
Event fired when Game Phase changes. More... | |
System.EventHandler< PersistenceEventArgs > | DoPendingSaves |
Trigger saves. More... | |
The master Game Manager controls loading characters, triggering persistence, and setting up the game ready to play.
|
protectedvirtual |
Does the load after a delay.
void PlatformerPro.PlatformerProGameManager.ForceSave | ( | ) |
Force all persistables to save.
Character PlatformerPro.PlatformerProGameManager.GetCharacterForPlayerId | ( | int | playerId | ) |
Gets the character for fiven player identifier. If id = -1 return first active character. Returns null if no character for playerId
playerId | Player identifier. |
|
protectedvirtual |
Handle game over events
sender | Sender. |
e | E. |
|
protectedvirtual |
Initialise this instance. Called form Awake.
|
protectedvirtual |
Loads the character.
|
protectedvirtual |
Loads the character with the given id.
playerId | Player identifier. |
characterId | CharacterId. |
|
protectedvirtual |
Raises the character loaded event.
|
protectedvirtual |
Raises the character removed event.
|
protectedvirtual |
Raises the phase change event.
phase | Completed phase. |
|
protectedvirtual |
Called from start. Use this to get references, etc.
|
protectedvirtual |
After start frame tell send events for loaded characters.
|
protectedvirtual |
Send the character loaded event after yielding for a frame.
c | C. |
void PlatformerPro.PlatformerProGameManager.ReplaceCharacter | ( | int | playerId, |
string | characterId | ||
) |
Replace a character with a different one.
playerId | Player identifier. |
characterId | Character identifier. |
|
static |
Sets the character to load for a given player;
playerId | Player identifier. |
characterId | Character identifier. |
void PlatformerPro.PlatformerProGameManager.SpawnNewCharacter | ( | int | playerId, |
string | characterId | ||
) |
Spawns a new character. Fails if a character with the supplied player id exists.
playerId | Player identifier. |
characterId | Character identifier. |
void PlatformerPro.PlatformerProGameManager.SwitchCharacter | ( | int | currentPlayerId, |
int | newPlayerId | ||
) |
Switches to a new character. Fails if a character with the supplied player id doesn't exist.
playerId | Player identifier. |
characterId | Character identifier. |
|
static |
UnSets the character to load for a given player;
playerId | Player identifier. |
characterId | Character identifier. |
|
virtual |
Validate required components.
myTarget |
Reimplemented from PlatformerPro.PlatformerProMonoBehaviour.
|
static |
Constant for a player id that matches any player.
List<AvailableCharacterData> PlatformerPro.PlatformerProGameManager.availableCharacters |
List of all available characters. These can be loaded at the start of the game or while the game is in progress. If there is only one character in this list it will be automatically loaded.
|
staticprotected |
List of character ids which should be loaded on Start(). One slot per player. If a slot is null tha given player is not playing.
PersistenceResetType PlatformerPro.PlatformerProGameManager.defaultPersistenceReset |
How do we handle persistence reset?
bool PlatformerPro.PlatformerProGameManager.enablePersistence = true |
Should we enable saving and loading?
GameOverType PlatformerPro.PlatformerProGameManager.endGameWhen |
When does the game end.
PersistableEnemyType PlatformerPro.PlatformerProGameManager.enemyPersistenceType = PersistableEnemyType.ALIVE_DEAD |
Should we persist enemy state by default.
|
protected |
The game loading phase.
|
staticprotected |
Tracks if we have initialised an instance of the game manager.
|
staticprotected |
Stores the singleton instance.
bool PlatformerPro.PlatformerProGameManager.isMapOrMenu |
Set to true if this is not a normal playable level.
PersistableObjectType PlatformerPro.PlatformerProGameManager.itemPersistenceType = PersistableObjectType.ACTIVATE_DEACTIVATE |
Should we persist item state by default.
|
protected |
All the loaded characters.
bool PlatformerPro.PlatformerProGameManager.persistObjectsInLevel |
Should we (by default) persist platformer pro object like doors, platforms, items, etc. You can override on invidiual objects.
bool PlatformerPro.PlatformerProGameManager.saveOnAnyChange |
Will we save always, or only when the cahracter dies or leaves a scene.
bool PlatformerPro.PlatformerProGameManager.saveOnAnyChangeEditorOnly |
Save always, but only in the editor.
float PlatformerPro.PlatformerProGameManager.saveRate = 1.0f |
Regardless of how often Save is called, don't save faster than this.
|
protected |
Track how long until the next save.
bool PlatformerPro.PlatformerProGameManager.spawnedItemPersistence = false |
Should we persist items spawned in to the scene.
bool PlatformerPro.PlatformerProGameManager.useBinaryFormat = true |
Should we save using binary files (true) or XML files (false).
|
getprotected set |
Gets or sets the game loading phase and send an event when set.
|
get |
Gets the header string used to describe the component.
The header.
|
staticgetprotected set |
Gets a character loader (generally for single character games only).
|
get |
Returns all loaded characters. WARNING: For performance reasons this is not a copy.
|
getprotected set |
Gets or sets the persistable object manager.
The persistable object manager.
System.EventHandler<CharacterEventArgs> PlatformerPro.PlatformerProGameManager.CharacterLoaded |
Event fired when a character finishes loading.
System.EventHandler<CharacterEventArgs> PlatformerPro.PlatformerProGameManager.CharacterRemoved |
Event fired when a character is removed.
System.EventHandler<PersistenceEventArgs> PlatformerPro.PlatformerProGameManager.DoPendingSaves |
Trigger saves.
System.EventHandler<GamePhaseEventArgs> PlatformerPro.PlatformerProGameManager.PhaseChanged |
Event fired when Game Phase changes.