Items are things that characters can pick up and use. They can be held in this "bag". The Bag component can be placed on characters that should be able to carry items. Bags work with either weight or slots (or no limit) as configured in ItemsAsset.storageMethod
More...
Inherits MonoBehaviour, and plyGame.IPersistable.
|
enum | ItemDropOption { andDestroy,
toScene
} |
|
|
void | Save (string key) |
|
void | Load (string key) |
|
void | DeleteSaveData (string key) |
|
void | DisablePersistence () |
|
int | GetSlotCount () |
| Return the number of slots the Bag has. Even if the storage method is not slot based the Items are still stacked in slots and this info could be useful when visually laying out the Items. More...
|
|
void | ChangeMaxWeightBy (int val) |
|
void | AddCurrency (int amount) |
| Add an amount of currency. More...
|
|
bool | RemoveCurrency (int amount) |
| Remove an amount of currency. Return false if did not have enough currency and thus nothing was done. More...
|
|
bool | HasCurrencyAmount (int amount) |
| Return true if has an amount of currency. More...
|
|
bool | AddItemToBag (Item it) |
| Add a copy of the item to the bag. Return false if failed to add, perhaps bag is full. More...
|
|
bool | RemoveItemFromBag (Item it, ItemDropOption opt, bool triggerEvents) |
| Remove 1 copy of the item from bag. return false if item not found. use one of the other functions if you want better control over which item in bag is removed since this will grab the first one that is valid. More...
|
|
bool | RemoveItemFromBag (int bagSlot, ItemDropOption opt, bool triggerEvents) |
| Remove 1 copy of the item from the specific bag slot. return false if failed - item not found in slot. More...
|
|
bool | RemoveItemFromBag (ItemInBag iib, ItemDropOption opt, bool triggerEvents) |
| Remove 1 copy of the item from bag. return false if item not found. More...
|
|
ItemInBag | GetItemInSlot (int bagSlot) |
| Return the item at specified slot or slot occupied by an item that spans more than one slot. Null if no Item available. More...
|
|
ItemInBag | FindItem (Item it) |
| Return first occurrence of Item in Bag. Null if not found. More...
|
|
int | ItemCount (Item it) |
| Return how many copies of the Item is present in the Bag. More...
|
|
bool | HasItem (Item it) |
| Return True if at least one copy of the Item exist in the Bag. More...
|
|
bool | UseItem (Item it) |
| Will check if the item exists and then use it. Will return false if failed (for example item not found) Will only trigger use if item is equipped when set to canEquip. Will only trigger use on item in bag if not set to canEquip. More...
|
|
bool | UseItem (int bagSlot) |
| Trigger use on specific Item in bag More...
|
|
bool | UseItem (ItemInBag iib) |
| Trigger use on specific Item in bag More...
|
|
|
float | maxWeight = 100f |
|
int | slotsWidth = 10 |
|
int | slotsHeight = 5 |
|
bool | persistenceOn = true |
|
|
void | Awake () |
|
void | Start () |
|
|
int | currency [get, set] |
|
float | currWeight [get, set] |
|
List< ItemInBag > | items [get, set] |
|
Items are things that characters can pick up and use. They can be held in this "bag". The Bag component can be placed on characters that should be able to carry items. Bags work with either weight or slots (or no limit) as configured in ItemsAsset.storageMethod
void plyGame.ItemBag.AddCurrency |
( |
int |
amount | ) |
|
Add an amount of currency.
bool plyGame.ItemBag.AddItemToBag |
( |
Item |
it | ) |
|
Add a copy of the item to the bag. Return false if failed to add, perhaps bag is full.
ItemInBag plyGame.ItemBag.FindItem |
( |
Item |
it | ) |
|
Return first occurrence of Item in Bag. Null if not found.
ItemInBag plyGame.ItemBag.GetItemInSlot |
( |
int |
bagSlot | ) |
|
Return the item at specified slot or slot occupied by an item that spans more than one slot. Null if no Item available.
int plyGame.ItemBag.GetSlotCount |
( |
| ) |
|
Return the number of slots the Bag has. Even if the storage method is not slot based the Items are still stacked in slots and this info could be useful when visually laying out the Items.
bool plyGame.ItemBag.HasCurrencyAmount |
( |
int |
amount | ) |
|
Return true if has an amount of currency.
bool plyGame.ItemBag.HasItem |
( |
Item |
it | ) |
|
Return True if at least one copy of the Item exist in the Bag.
int plyGame.ItemBag.ItemCount |
( |
Item |
it | ) |
|
Return how many copies of the Item is present in the Bag.
bool plyGame.ItemBag.RemoveCurrency |
( |
int |
amount | ) |
|
Remove an amount of currency. Return false if did not have enough currency and thus nothing was done.
bool plyGame.ItemBag.RemoveItemFromBag |
( |
Item |
it, |
|
|
ItemDropOption |
opt, |
|
|
bool |
triggerEvents |
|
) |
| |
Remove 1 copy of the item from bag. return false if item not found. use one of the other functions if you want better control over which item in bag is removed since this will grab the first one that is valid.
bool plyGame.ItemBag.RemoveItemFromBag |
( |
int |
bagSlot, |
|
|
ItemDropOption |
opt, |
|
|
bool |
triggerEvents |
|
) |
| |
Remove 1 copy of the item from the specific bag slot. return false if failed - item not found in slot.
bool plyGame.ItemBag.RemoveItemFromBag |
( |
ItemInBag |
iib, |
|
|
ItemDropOption |
opt, |
|
|
bool |
triggerEvents |
|
) |
| |
Remove 1 copy of the item from bag. return false if item not found.
bool plyGame.ItemBag.UseItem |
( |
Item |
it | ) |
|
Will check if the item exists and then use it. Will return false if failed (for example item not found) Will only trigger use if item is equipped when set to canEquip. Will only trigger use on item in bag if not set to canEquip.
bool plyGame.ItemBag.UseItem |
( |
int |
bagSlot | ) |
|
Trigger use on specific Item in bag
bool plyGame.ItemBag.UseItem |
( |
ItemInBag |
iib | ) |
|
Trigger use on specific Item in bag