![]() |
Platformer Pro
2.3.2
A platform game kit for Unity.
|
Stores details about the items a character has collected. Should be on the same Game Object as the character. More...
Public Member Functions | |
virtual void | OnInventoryChanged () |
Raises the inventory rearranged event. More... | |
virtual void | Init (Character character) |
Init with the specified character. More... | |
virtual int | CollectItem (Item item) |
Collect the given item. More... | |
virtual bool | DropItemFromInventorySlot (int index) |
Drops the item in slot. More... | |
virtual void | ApplyItemEffects (string typeId) |
Applies the item effects for the item with given id. More... | |
virtual void | ApplyItemEffects (ItemTypeData itemTypeData) |
Apply effects from item data. More... | |
virtual void | RemoveItemEffects (string typeId) |
Removes the item effects for the item with given id. More... | |
virtual void | ShowItemPickUpBox (Item item) |
Shows the item pickup box (for when auto pickup is off). More... | |
virtual void | HideItemPickUpBox (Item item) |
Hides the item pickup box (for when auto pickup is off). More... | |
virtual void | RemoveItemEffects (ItemTypeData itemData) |
Removes the item effects. More... | |
virtual int | SetItemCount (string itemType, int amount) |
Sets the item count without raising a collection event. More... | |
virtual int | ItemCount (string itemType) |
Gets the number of items of the given type. More... | |
virtual int | ItemMax (string itemType) |
Gets the maximum number of items for the given type. More... | |
virtual int | ConsumeItem (string itemType, int amount) |
Consumes the given amount of items of type itemType without applying any effects! Does not work for equipped items. More... | |
virtual int | ConsumeItemFromInventorySlot (int index) |
Consumes the items in the given inventory slot without applying any effects! More... | |
virtual int | UseItem (string itemType, int amount) |
Uses the given amount of items of type itemType applying any effects. More... | |
virtual bool | UseItemFromInventorySlot (int index) |
Uses a single item from a specific inventory slot. More... | |
virtual bool | DamageItemInEquipmentSlot (string slot, int amount) |
virtual List< ItemAndCount > | GetItems () |
Gets a list of items that the character has. More... | |
virtual bool | HasItem (string itemType) |
Returns true if the character has at least one of the given item. More... | |
virtual int | CollectItem (string itemId, int amount) |
Handle collecting an item, based on type dta instead ofinstance data. NOTE: You should use instance data wherever possible or else variables like durability will not be tracked. More... | |
virtual int | CollectItem (ItemInstanceData data) |
Handle collecting an item. More... | |
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... | |
override System.Type[] | GetExtraTypes () |
Support complex object serialisation by passing additional types to seralizer. More... | |
![]() | |
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 | |
int | pickUpActionButton = -1 |
Which action button to use for pickups, or -1 for autopickup More... | |
ItemPickupBox | itemPickupBox |
If we don't automatically pick up Items then this object will be shown when an object can be picked up. More... | |
bool | dropAllItemsInStack = true |
Should we drop one item at a time from a stack, or all items in a stack. More... | |
Vector3 | dropOffset |
Where does the drop spawn from relative to character. More... | |
Vector2 | dropImpulse = new Vector2(0, 1f) |
Should we impart some velocity to an item when dropped? More... | |
bool | ignoreZeroValuedMultipliers = true |
If true then we allow zero valued multipliers. Otherwise we ignore them and raise a warning. More... | |
![]() | |
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 = "ItemManagerData" |
The player preference identifier. More... | |
![]() | |
const string | BasePlayerPrefId = "PP.Persistent." |
The base player preference identifier. More... | |
Protected Member Functions | |
virtual void | OnItemCollected (string type, int amount, Character character) |
Raises the item collected event. More... | |
virtual void | OnItemConsumed (string type, int amount, Character character) |
Raises the item consumed event. More... | |
virtual void | OnItemDamaged (ItemInstanceData data) |
Raises the item damaged event More... | |
virtual void | OnItemDestroyed (ItemInstanceData data) |
Raises the item consumed event. More... | |
virtual void | OnItemDepleted (string type, Character character) |
Raises the item depleted event. More... | |
virtual void | OnItemDropped (string type, Character character) |
Raises the item dropped event. More... | |
virtual void | OnItemMaxUpdated (string type, int amount, Character character) |
Raises the item max updated event. More... | |
virtual void | SpawnDroppedItem (ItemInstanceData itemInstanceData, int amountToDrop) |
Spawns a dropped item in the scene at Character position. More... | |
virtual bool | DoUseItem (ItemTypeData itemTypeData, int amount) |
Uses the given item, but does not handle removing it from stack/inventory. More... | |
override void | RecalculateEffectsOfItems () |
Updates item multiplier stats. More... | |
![]() | |
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 | |
Character | character |
The character this item manager applies to. More... | |
List< ItemTypeData > | itemTypeData |
Data about available item types. More... | |
ItemData | itemData |
The item data. More... | |
bool | recalculateEffectsOfItems |
Should we recalculate the effects of items this frame? More... | |
![]() | |
float | totalJumpHeightMultiplier = 1.0f |
float | totalMoveSpeedMultiplier = 1.0f |
float | totalRunSpeedMultiplier = 1.0f |
float | totalAccelerationMultiplier = 1.0f |
int | totalMaxHealthAdjustment = 1 |
float | totalDamageMultiplier = 1.0f |
float | totalWeaponSpeedMultiplier = 1.0f |
![]() | |
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 string | Header [get] |
override Character | Character [get, set] |
Gets the character reference. 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... | |
![]() | |
virtual float | TotalJumpHeightMultiplier [get] |
Gets the total JumpHeightMultiplier of all equipped items, updated whenever items are equipped. More... | |
virtual float | TotalMoveSpeedMultiplier [get] |
Gets the total MoveSpeedMultiplier of all equipped items, updated whenever items are equipped. More... | |
virtual float | TotalRunSpeedMultiplier [get] |
Gets the total RunSpeedMultiplier of all equipped items, updated whenever items are equipped. More... | |
virtual float | TotalAccelerationMultiplier [get] |
Gets the total AccelerationMultiplier of all equipped items, updated whenever items are equipped. More... | |
virtual int | TotalMaxHealthAdjustment [get] |
Gets the total MaxHealthAdjustment of all equipped items, updated whenever items are equipped. More... | |
virtual float | TotalDamageMultiplier [get] |
Gets the total DamageMultiplier of all equipped items, updated whenever items are equipped. More... | |
virtual float | TotalWeaponSpeedMultiplier [get] |
Gets the total WeaponSpeedMultiplier of all equipped items, updated whenever items are equipped. More... | |
![]() | |
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... | |
![]() | |
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... | |
![]() | |
Character | Character [get, set] |
Get the character. More... | |
Events | |
System.EventHandler< ItemEventArgs > | ItemCollected |
Item collected. More... | |
System.EventHandler< ItemEventArgs > | ItemConsumed |
Item consumed. More... | |
System.EventHandler< ItemEventArgs > | ItemDamaged |
Occurs when item damaged. More... | |
System.EventHandler< ItemEventArgs > | ItemDestroyed |
Occurs when item damaged. More... | |
System.EventHandler< ItemEventArgs > | ItemDepleted |
Sent when item is consumed and none remain. More... | |
System.EventHandler< ItemEventArgs > | ItemDropped |
Sent when item is dropped. More... | |
System.EventHandler< ItemEventArgs > | ItemMaxUpdated |
Item collected. More... | |
System.EventHandler< CharacterEventArgs > | InventoryChanged |
Called when inventory items are changed without neccessarily updating item counts (for example rearranging). More... | |
![]() | |
System.EventHandler< EmptyEventArgs > | Loaded |
Sent when this persistable is loaded. More... | |
Additional Inherited Members | |
![]() | |
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 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... | |
Stores details about the items a character has collected. Should be on the same Game Object as the character.
|
virtual |
Apply effects from item data.
itemData | Item data. |
|
virtual |
Applies the item effects for the item with given id.
typeId | Type identifier. |
|
virtual |
Applies the save data to the object.
Implements PlatformerPro.Persistable.
|
virtual |
|
virtual |
Handle collecting an item.
data | Item instance data, including amount, etc. |
|
virtual |
Handle collecting an item, based on type dta instead ofinstance data. NOTE: You should use instance data wherever possible or else variables like durability will not be tracked.
itemId | Id oif the itme to add |
|
virtual |
Consumes the given amount of items of type itemType without applying any effects! Does not work for equipped items.
itemType | Item type. |
amount | Amount to consume. |
|
virtual |
Consumes the items in the given inventory slot without applying any effects!
index | Inventory slot. |
|
virtual |
|
protectedvirtual |
Uses the given item, but does not handle removing it from stack/inventory.
true
, if item can be used, false
otherwise false.itemTypeData | Item type data. |
|
virtual |
Drops the item in slot.
index | slot index. |
|
virtual |
Support complex object serialisation by passing additional types to seralizer.
Reimplemented from PlatformerPro.Persistable.
|
virtual |
Gets a list of items that the character has.
///
|
virtual |
Returns true if the character has at least one of the given item.
itemType | Item type. |
|
virtual |
Hides the item pickup box (for when auto pickup is off).
|
virtual |
Init with the specified character.
character | Character. |
Implements PlatformerPro.ICoreComponent.
|
virtual |
|
virtual |
Gets the maximum number of items for the given type.
itemType | Item type. |
|
virtual |
Raises the inventory rearranged event.
|
protectedvirtual |
Raises the item collected event.
type | Type. |
amount | Number collected. |
character | Character. |
|
protectedvirtual |
Raises the item consumed event.
type | Type. |
amount | Number consumed. |
character | Character. |
|
protectedvirtual |
Raises the item damaged event
data | Item Data. |
|
protectedvirtual |
Raises the item depleted event.
type | Type. |
character | Character. |
|
protectedvirtual |
Raises the item consumed event.
data | Item data. |
|
protectedvirtual |
Raises the item dropped event.
type | Type. |
character | Character. |
|
protectedvirtual |
|
protectedvirtual |
Updates item multiplier stats.
Implements PlatformerPro.ItemStatProvider.
|
virtual |
Removes the item effects.
itemData | Item data. |
|
virtual |
Removes the item effects for the item with given id.
typeId | Type identifier. |
|
virtual |
Resets the save data back to default.
Implements PlatformerPro.Persistable.
|
virtual |
Get the type of object this Persistable saves.
Implements PlatformerPro.Persistable.
|
virtual |
|
virtual |
Shows the item pickup box (for when auto pickup is off).
item |
|
protectedvirtual |
|
virtual |
Uses the given amount of items of type itemType applying any effects.
itemType | Item type. |
amount | Amount to consume. |
|
virtual |
Uses a single item from a specific inventory slot.
true
, if item from inventory slot was used, false
otherwise.index | Index. |
|
protected |
The character this item manager applies to.
bool PlatformerPro.ItemManager.dropAllItemsInStack = true |
Should we drop one item at a time from a stack, or all items in a stack.
Vector2 PlatformerPro.ItemManager.dropImpulse = new Vector2(0, 1f) |
Should we impart some velocity to an item when dropped?
Vector3 PlatformerPro.ItemManager.dropOffset |
Where does the drop spawn from relative to character.
bool PlatformerPro.ItemManager.ignoreZeroValuedMultipliers = true |
If true then we allow zero valued multipliers. Otherwise we ignore them and raise a warning.
|
protected |
The item data.
ItemPickupBox PlatformerPro.ItemManager.itemPickupBox |
If we don't automatically pick up Items then this object will be shown when an object can be picked up.
|
protected |
Data about available item types.
int PlatformerPro.ItemManager.pickUpActionButton = -1 |
Which action button to use for pickups, or -1 for autopickup
|
protected |
Should we recalculate the effects of items this frame?
|
static |
The player preference identifier.
|
getset |
Gets the character reference.
The character.
|
get |
|
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.
|
get |
Gets the data to save.
System.EventHandler<CharacterEventArgs> PlatformerPro.ItemManager.InventoryChanged |
Called when inventory items are changed without neccessarily updating item counts (for example rearranging).
System.EventHandler<ItemEventArgs> PlatformerPro.ItemManager.ItemCollected |
Item collected.
System.EventHandler<ItemEventArgs> PlatformerPro.ItemManager.ItemConsumed |
Item consumed.
System.EventHandler<ItemEventArgs> PlatformerPro.ItemManager.ItemDamaged |
Occurs when item damaged.
System.EventHandler<ItemEventArgs> PlatformerPro.ItemManager.ItemDepleted |
Sent when item is consumed and none remain.
System.EventHandler<ItemEventArgs> PlatformerPro.ItemManager.ItemDestroyed |
Occurs when item damaged.
System.EventHandler<ItemEventArgs> PlatformerPro.ItemManager.ItemDropped |
Sent when item is dropped.
System.EventHandler<ItemEventArgs> PlatformerPro.ItemManager.ItemMaxUpdated |
Item collected.