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

Base class for all collectible things. More...

Inheritance diagram for PlatformerPro.Item:
PlatformerPro.PersistableObject PlatformerPro.PlatformerProMonoBehaviour

Public Member Functions

virtual void DoDrop (string prefabName)
 Called after an item is spawned from a drop. More...
 
virtual void DoCollect (Character character)
 Do the collection. More...
 
virtual void Reset ()
 Reset this instance. More...
 
- Public Member Functions inherited from PlatformerPro.PersistableObject
void SetPersistenceState (bool state)
 Sets the persistence state. More...
 
void SetPersistenceState (bool state, string extraPersistenceData)
 Sets the persistence state, overriding extra persistence data 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

ItemInstanceData instanceData
 
bool autoPickUp
 
bool useDefaultPersistence = true
 Does this Item get persistence defaults form the Game manager? More...
 
jnamobile.mmm.PointOfInterest poi
 Reference to point of interest on a map. You can use this to override item POI settings. More...
 
- Public Attributes inherited from PlatformerPro.PersistableObject
bool enablePersistence
 Should we enable persistence? More...
 
string guid = System.Guid.NewGuid().ToString()
 Unique ID for this object. You shoulnd't need to edit this, use editor debug mode if you must. More...
 
GameObject target
 GameObject to apply persitence settings to, defaults to self. More...
 
PersistableObjectType persistenceImplementation
 How do we implement the persistence settings. More...
 
bool defaultStateIsDisabled
 If true then the obejct starts disabled. More...
 
string spawnedObjectName
 If this item was spawned then save the name of the prefab here. More...
 

Protected Member Functions

virtual void OnCollectItem (Character character)
 Raises the item collected event. More...
 
virtual void OnCollectItem (string type, int amount, Character character)
 Raises the item collected event. More...
 
override void PostInit ()
 Init item references etc. Called form Start(). More...
 
override void SetPersistenceDefaults ()
 Sets the persistence defaults. More...
 
virtual void CheckCollect (Collider2D other)
 Check if the collection is valid (in this case by checking if its a character colliding). More...
 
virtual void DoEventForCollect (Character character)
 Send a collect event if we have any listeners or else deactivates object. More...
 
bool CollectHasListener ()
 Check if there is a listener for the collect event. More...
 
override void ApplyExtraPersistenceData (PersistableObjectData data)
 Apply any extra data. For items this is durability and amount. More...
 
- Protected Member Functions inherited from PlatformerPro.PersistableObject
virtual void ProcessState ()
 Processes the persisted state. More...
 
virtual void ApplyCustomPersistence (PersistableObjectData data)
 Custom persistable implementation. Override to customise. More...
 

Protected Attributes

Collider2D myCollider
 The items collider. More...
 
bool hasHitCharacter
 Tracks if this item has already been collected. More...
 

Properties

string ItemId [get, set]
 Type of item (e.g. 'coin', 'gem', etc). Should match the value in the ItemManager. Type of item (e.g. 'coin', 'gem', etc). Should match the value in the ItemManager. More...
 
int Amount [get, set]
 How many are in this 'pile' More...
 
override string ExtraPersistenceData [get]
 Gets the extra persistence data. More...
 
- Properties inherited from PlatformerPro.PersistableObject
virtual string ExtraPersistenceData [get]
 Gets the extra persistence data. 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...
 

Events

System.EventHandler< ItemEventArgsCollectItem
 Power up collected. More...
 

Detailed Description

Base class for all collectible things.

Member Function Documentation

◆ ApplyExtraPersistenceData()

override void PlatformerPro.Item.ApplyExtraPersistenceData ( PersistableObjectData  data)
protectedvirtual

Apply any extra data. For items this is durability and amount.

Parameters
dataData.

Reimplemented from PlatformerPro.PersistableObject.

◆ CheckCollect()

virtual void PlatformerPro.Item.CheckCollect ( Collider2D  other)
protectedvirtual

Check if the collection is valid (in this case by checking if its a character colliding).

Parameters
otherOther.

◆ CollectHasListener()

bool PlatformerPro.Item.CollectHasListener ( )
protected

Check if there is a listener for the collect event.

◆ DoCollect()

virtual void PlatformerPro.Item.DoCollect ( Character  character)
virtual

Do the collection.

Parameters
characterCharacter doing the collection.

◆ DoDrop()

virtual void PlatformerPro.Item.DoDrop ( string  prefabName)
virtual

Called after an item is spawned from a drop.

◆ DoEventForCollect()

virtual void PlatformerPro.Item.DoEventForCollect ( Character  character)
protectedvirtual

Send a collect event if we have any listeners or else deactivates object.

Parameters
characterCharacter.

◆ OnCollectItem() [1/2]

virtual void PlatformerPro.Item.OnCollectItem ( Character  character)
protectedvirtual

Raises the item collected event.

Parameters
typeType.
characterCharacter.

◆ OnCollectItem() [2/2]

virtual void PlatformerPro.Item.OnCollectItem ( string  type,
int  amount,
Character  character 
)
protectedvirtual

Raises the item collected event.

Parameters
typeType.
amountNumber collected.
characterCharacter.

◆ PostInit()

override void PlatformerPro.Item.PostInit ( )
protectedvirtual

Init item references etc. Called form Start().

Reimplemented from PlatformerPro.PersistableObject.

◆ Reset()

virtual void PlatformerPro.Item.Reset ( )
virtual

Reset this instance.

◆ SetPersistenceDefaults()

override void PlatformerPro.Item.SetPersistenceDefaults ( )
protectedvirtual

Sets the persistence defaults.

Reimplemented from PlatformerPro.PersistableObject.

Member Data Documentation

◆ autoPickUp

bool PlatformerPro.Item.autoPickUp

◆ hasHitCharacter

bool PlatformerPro.Item.hasHitCharacter
protected

Tracks if this item has already been collected.

◆ instanceData

ItemInstanceData PlatformerPro.Item.instanceData

◆ myCollider

Collider2D PlatformerPro.Item.myCollider
protected

The items collider.

◆ poi

jnamobile.mmm.PointOfInterest PlatformerPro.Item.poi

Reference to point of interest on a map. You can use this to override item POI settings.

◆ useDefaultPersistence

bool PlatformerPro.Item.useDefaultPersistence = true

Does this Item get persistence defaults form the Game manager?

Property Documentation

◆ Amount

int PlatformerPro.Item.Amount
getset

How many are in this 'pile'

◆ ExtraPersistenceData

override string PlatformerPro.Item.ExtraPersistenceData
getprotected

Gets the extra persistence data.

The extra persistence data.

◆ ItemId

string PlatformerPro.Item.ItemId
getset

Type of item (e.g. 'coin', 'gem', etc). Should match the value in the ItemManager. Type of item (e.g. 'coin', 'gem', etc). Should match the value in the ItemManager.

Event Documentation

◆ CollectItem

System.EventHandler<ItemEventArgs> PlatformerPro.Item.CollectItem

Power up collected.


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