Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.ActivationGroup Class Reference

Activation groups provide a set of ID's that can be turned on of off (activated or deactivated). The state of these can be used to drive things like the active weapon, or character powers More...

Inheritance diagram for PlatformerPro.ActivationGroup:
PlatformerPro.Persistable PlatformerPro.PlatformerProMonoBehaviour PlatformerPro.ICharacterReference

Public Member Functions

virtual bool IsActive (string itemId)
 Returns true if given item is activated. More...
 
virtual List< string > AllItems ()
 Gets a list of all items. Note this creates a new list so should not be used every frame. More...
 
virtual List< string > AllActiveItems ()
 Gets a list of all active items. Note this creates a new list so should not be used every frame. More...
 
virtual bool Activate (string itemId)
 Activate the specified itemId. More...
 
virtual void Next ()
 Activates the next item in the group (only if onlyOneActive == true). Takes in to account conditions such as inventory, so if item 1 is active and there is no ammo for item 2 , calling Next() will move on to item 3. More...
 
virtual void Previous ()
 Activates the previous item in the group (only if onlyOneActive == true). Takes in to account conditions such as inventory, so if item 3 is active and there is no ammo for item 2 , calling previous() will move on to item 1. More...
 
virtual bool Deactivate (string itemId)
 Deactivate the specified itemId. More...
 
virtual void Reset ()
 
override void ApplySaveData (object t)
 Applies the save data to the object. More...
 
override System.Type SavedObjectType ()
 Get the type of object this Persistable saves. More...
 
override void ResetSaveData ()
 Resets the save data back to default. More...
 
- Public Member Functions inherited from PlatformerPro.Persistable
virtual System.Type[] GetExtraTypes ()
 Support complex object serialisation by passing additional types to seralizer. More...
 
- Public Member Functions inherited from PlatformerPro.PlatformerProMonoBehaviour
virtual void Validate (PlatformerProMonoBehaviour myTarget)
 Override this method if you want to provide custom validation. The actual code should be surrounded by the if UNITY_EDITOR / endif directive. More...
 

Public Attributes

string groupName
 Unique name for this group. More...
 
bool onlyOneActive
 Does this group only allow one item to be active at a time. More...
 
bool sendActivationEventsOnLoad
 If true send events indicating activation when the data is loaded. If false don't. More...
 
bool requireMatchingItem
 If true the activation items must match an item in the ItemManager or they will not be activatable. More...
 
string defaultItem
 If not empty the matching item will be activated by default. More...
 
List< string > items
 The list of items in this group. More...
 
- Public Attributes inherited from PlatformerPro.Persistable
bool usePersistenceDefaults = true
 Should we use the persistence defaults or override with our own values. More...
 
bool enablePersistence = true
 Should we enable persistence. More...
 
bool saveOnAnyChange
 Save whenever this value changes (Note: not supported by all objects). More...
 
PersistenceResetType persistenceType
 When do we reset persistence? More...
 

Static Public Attributes

const string UniqueDataIdentifier = "ActivationGroupData"
 The player preference identifier. More...
 
- Static Public Attributes inherited from PlatformerPro.Persistable
const string BasePlayerPrefId = "PP.Persistent."
 The base player preference identifier. More...
 

Protected Member Functions

virtual void OnActivated (string itemId)
 Raises the activated event. More...
 
virtual void OnDeactivated (string itemId)
 Raises the deactivated event. More...
 
virtual void OnAllActivated ()
 Raises the all activated event. More...
 
virtual void Init ()
 Init this instance. More...
 
virtual void HandleCharacterLoaded (object sender, CharacterEventArgs e)
 Handles the character loaded event. More...
 
- Protected Member Functions inherited from PlatformerPro.Persistable
virtual void OnLoaded ()
 Raises the loaded event. More...
 
virtual void ConfigureEventListeners ()
 Init this instance. More...
 
virtual void DoPendingSaves (object sender, PersistenceEventArgs e)
 Trigger any pending saves. More...
 
virtual void PhaseChange (object sender, GamePhaseEventArgs e)
 Handle a change of game phase, look for persistence event and apply. More...
 
virtual void HandleRespawn (object sender, CharacterEventArgs e)
 Handle a change of game phase, look for persistence event and apply. More...
 
virtual void HandleWillExitScene (object sender, SceneEventArgs e)
 Handles the will exit scene event More...
 
virtual void HandleGameOver (object sender, CharacterEventArgs e)
 Handles the game over event More...
 
virtual void HandleDied (object sender, DamageInfoEventArgs e)
 Handles the died event. More...
 

Protected Attributes

List< string > activeItems
 The items currently active. More...
 
Character character
 Cached reference to character if we can find one. More...
 
ItemManager itemManager
 Cached reference to item manager used when requireMatchingItem is true. More...
 
PlatformerProGameManager characterLoader
 Cached reference to a character loader. More...
 
List< string > itemsToDeactivate
 A list of items to deactive when we operate in 'only one' mode. Used to avoid creating a new list each time this is called. More...
 
- Protected Attributes inherited from PlatformerPro.Persistable
bool loaded
 Have we loaded the data yet? More...
 
bool readyToSave
 Are we ready to save on the next save tick? More...
 
Persistable latestSaveData
 Data to save when we trigger the next save tick. More...
 

Properties

override Character Character [get, set]
 Gets the character. More...
 
override object SaveData [get]
 Gets the data to save. More...
 
override string Identifier [get]
 Get a unique identifier to use when saving the data (for example this could be used for part of the file name or player prefs name). More...
 
- Properties inherited from PlatformerPro.Persistable
virtual string PlayerPrefsIdentifier [get]
 The player preference identifier. More...
 
virtual bool EnablePersistence [get]
 Gets the value for persistence type taking in to account defaults. More...
 
virtual PersistenceResetType PersistenceType [get]
 Gets the value for persistence type taking in to account defaults. More...
 
virtual bool SaveOnChange [get]
 Gets the value for save on change type taking in to account defaults. More...
 
abstract Character Character [get, set]
 Gets the character. More...
 
abstract object SaveData [get]
 Gets the data to save. More...
 
abstract string Identifier [get]
 Get a unique identifier to use when saving the data (for example this could be used for part of the file name or player prefs name). More...
 
- Properties inherited from PlatformerPro.PlatformerProMonoBehaviour
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...
 
- Properties inherited from PlatformerPro.ICharacterReference
Character Character [get, set]
 Get the character. More...
 

Events

System.EventHandler< ActivationEventArgsActivated
 Item activated. More...
 
System.EventHandler< ActivationEventArgsDeactivated
 Item deactivated. More...
 
System.EventHandler< ActivationEventArgsAllActivated
 All items activated. More...
 
- Events inherited from PlatformerPro.Persistable
System.EventHandler< EmptyEventArgsLoaded
 Sent when this persistable is loaded. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from PlatformerPro.Persistable
static void Save (Persistable p)
 Save the given persistable. More...
 
static void SaveXml (Persistable p)
 Save the given persistable in XML format. More...
 
static void SaveBinary (Persistable p)
 Save the given persistable in XML format. More...
 
static void Load (Persistable p)
 Load the given persistable. More...
 
static void Reset (Persistable p)
 Resets the given persistable. More...
 
- Static Protected Member Functions inherited from PlatformerPro.Persistable
static object LoadSavedDataXml (Persistable p)
 Does the actual load and returns raw object. More...
 
static object LoadSavedDataBinary (Persistable p)
 Does the actual load and returns raw object. More...
 

Detailed Description

Activation groups provide a set of ID's that can be turned on of off (activated or deactivated). The state of these can be used to drive things like the active weapon, or character powers

They have some overlap with power-ups but unlike power-ups the group and items have no behaviour.

Becasue Activation groups DO NOT need to be attached to a character they can also be used to drive custom puzzle state.

Member Function Documentation

◆ Activate()

virtual bool PlatformerPro.ActivationGroup.Activate ( string  itemId)
virtual

Activate the specified itemId.

Parameters
itemIdItem identifier.
Returns
true if the item was activated or the item was already activated

◆ AllActiveItems()

virtual List<string> PlatformerPro.ActivationGroup.AllActiveItems ( )
virtual

Gets a list of all active items. Note this creates a new list so should not be used every frame.

Parameters
itemIdItem identifier.

◆ AllItems()

virtual List<string> PlatformerPro.ActivationGroup.AllItems ( )
virtual

Gets a list of all items. Note this creates a new list so should not be used every frame.

◆ ApplySaveData()

override void PlatformerPro.ActivationGroup.ApplySaveData ( object  t)
virtual

Applies the save data to the object.

Implements PlatformerPro.Persistable.

◆ Deactivate()

virtual bool PlatformerPro.ActivationGroup.Deactivate ( string  itemId)
virtual

Deactivate the specified itemId.

Parameters
itemIdItem identifier.
Returns
true if the item was deactivated or the item was already deactivated

◆ HandleCharacterLoaded()

virtual void PlatformerPro.ActivationGroup.HandleCharacterLoaded ( object  sender,
CharacterEventArgs  e 
)
protectedvirtual

Handles the character loaded event.

Parameters
senderSender.
eEvent.

◆ Init()

virtual void PlatformerPro.ActivationGroup.Init ( )
protectedvirtual

Init this instance.

◆ IsActive()

virtual bool PlatformerPro.ActivationGroup.IsActive ( string  itemId)
virtual

Returns true if given item is activated.

Parameters
itemIdItem identifier.

◆ Next()

virtual void PlatformerPro.ActivationGroup.Next ( )
virtual

Activates the next item in the group (only if onlyOneActive == true). Takes in to account conditions such as inventory, so if item 1 is active and there is no ammo for item 2 , calling Next() will move on to item 3.

◆ OnActivated()

virtual void PlatformerPro.ActivationGroup.OnActivated ( string  itemId)
protectedvirtual

Raises the activated event.

Parameters
itemIdItem identifier.

◆ OnAllActivated()

virtual void PlatformerPro.ActivationGroup.OnAllActivated ( )
protectedvirtual

Raises the all activated event.

◆ OnDeactivated()

virtual void PlatformerPro.ActivationGroup.OnDeactivated ( string  itemId)
protectedvirtual

Raises the deactivated event.

Parameters
itemIdItem identifier.

◆ Previous()

virtual void PlatformerPro.ActivationGroup.Previous ( )
virtual

Activates the previous item in the group (only if onlyOneActive == true). Takes in to account conditions such as inventory, so if item 3 is active and there is no ammo for item 2 , calling previous() will move on to item 1.

◆ Reset()

virtual void PlatformerPro.ActivationGroup.Reset ( )
virtual

◆ ResetSaveData()

override void PlatformerPro.ActivationGroup.ResetSaveData ( )
virtual

Resets the save data back to default.

Implements PlatformerPro.Persistable.

◆ SavedObjectType()

override System.Type PlatformerPro.ActivationGroup.SavedObjectType ( )
virtual

Get the type of object this Persistable saves.

Implements PlatformerPro.Persistable.

Member Data Documentation

◆ activeItems

List<string> PlatformerPro.ActivationGroup.activeItems
protected

The items currently active.

◆ character

Character PlatformerPro.ActivationGroup.character
protected

Cached reference to character if we can find one.

◆ characterLoader

PlatformerProGameManager PlatformerPro.ActivationGroup.characterLoader
protected

Cached reference to a character loader.

◆ defaultItem

string PlatformerPro.ActivationGroup.defaultItem

If not empty the matching item will be activated by default.

◆ groupName

string PlatformerPro.ActivationGroup.groupName

Unique name for this group.

◆ itemManager

ItemManager PlatformerPro.ActivationGroup.itemManager
protected

Cached reference to item manager used when requireMatchingItem is true.

◆ items

List<string> PlatformerPro.ActivationGroup.items

The list of items in this group.

◆ itemsToDeactivate

List<string> PlatformerPro.ActivationGroup.itemsToDeactivate
protected

A list of items to deactive when we operate in 'only one' mode. Used to avoid creating a new list each time this is called.

◆ onlyOneActive

bool PlatformerPro.ActivationGroup.onlyOneActive

Does this group only allow one item to be active at a time.

◆ requireMatchingItem

bool PlatformerPro.ActivationGroup.requireMatchingItem

If true the activation items must match an item in the ItemManager or they will not be activatable.

◆ sendActivationEventsOnLoad

bool PlatformerPro.ActivationGroup.sendActivationEventsOnLoad

If true send events indicating activation when the data is loaded. If false don't.

◆ UniqueDataIdentifier

const string PlatformerPro.ActivationGroup.UniqueDataIdentifier = "ActivationGroupData"
static

The player preference identifier.

Property Documentation

◆ Character

override Character PlatformerPro.ActivationGroup.Character
getset

Gets the character.

◆ Identifier

override string PlatformerPro.ActivationGroup.Identifier
get

Get a unique identifier to use when saving the data (for example this could be used for part of the file name or player prefs name).

The identifier.

◆ SaveData

override object PlatformerPro.ActivationGroup.SaveData
get

Gets the data to save.

Event Documentation

◆ Activated

System.EventHandler<ActivationEventArgs> PlatformerPro.ActivationGroup.Activated

Item activated.

◆ AllActivated

System.EventHandler<ActivationEventArgs> PlatformerPro.ActivationGroup.AllActivated

All items activated.

◆ Deactivated

System.EventHandler<ActivationEventArgs> PlatformerPro.ActivationGroup.Deactivated

Item deactivated.


The documentation for this class was generated from the following file: