![]() |
Adventure Creator
1.76.2
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
|
Public Member Functions | |
InvCollection () | |
InvCollection (List< InvItem > invItems) | |
InvCollection (List< InvInstance > _invInstances, bool allowEmptySlots=false) | |
A Constructor that populates itself based on an existing list of inventory item instances. More... | |
InvCollection (Container container) | |
void | Transfer (int invID, InvCollection fromCollection) |
Transfer all counts of a given inventory item from another collection More... | |
void | Transfer (InvInstance invInstance, InvCollection fromCollection) |
Transfer all counts of a given inventory item from another collection More... | |
void | Transfer (int invID, InvCollection fromCollection, int amount, bool matchPropertiesWhenMerging=true) |
Transfer a set count of a given inventory item from another collection More... | |
void | Transfer (InvInstance invInstance, InvCollection fromCollection, int amount, bool matchPropertiesWhenMerging=true) |
Transfer a set count of a given inventory item from another collection More... | |
void | TransferAll (InvCollection fromCollection) |
Transfers all items from another collection More... | |
InvInstance | Add (InvInstance addInstance, bool matchPropertiesWhenMerging=true) |
Adds an inventory item instance to the collection. If the item exists in another collection, it will be removed from there automatically. More... | |
InvInstance | AddToEnd (InvInstance addInstance) |
Adds an inventory item instance to the end of the collection - or the first-available empty slot. If the item exists in another collection, it will be removed from there automatically. More... | |
InvInstance | Insert (InvInstance addInstance, int index, OccupiedSlotBehaviour occupiedSlotBehaviour=OccupiedSlotBehaviour.ShiftItems, bool matchPropertiesWhenMerging=true) |
Inserts an inventory item instance into a specific index in the collection. If the item exists in another collection, it will be removed from there automatically. More... | |
void | Delete (InvInstance invInstance) |
Deletes a given inventory item instance, provided it is a part of this collection More... | |
void | Delete (InvInstance invInstance, int amount) |
Deletes a given inventory item instance, provided it is a part of this collection More... | |
void | Delete (int itemID, int amount) |
Deletes a set number of inventory item instances More... | |
void | DeleteAtIndex (int index, int amount) |
Deletes a set number of inventory item instances at a given index More... | |
void | DeleteAllOfType (int itemID) |
Deletes all inventory item instances associated with a given inventory item More... | |
void | DeleteAll () |
void | DeleteAllInCategory (int categoryID) |
Deletes all item instances in a specific category More... | |
void | DeleteRecipeIngredients (Recipe recipe) |
Deletes all item instances that make up a recipe's ingredients More... | |
int | IndexOf (InvInstance invInstance) |
string | GetSaveData () |
InvInstance | GetInstanceAtIndex (int index) |
Gets the inventory item instance in the collection at a given index More... | |
int | GetCount (int invID, bool includeMultipleInSameSlot=true) |
Gets the amount of instances in the collection that represent a given inventory item More... | |
int | GetCount (bool includeMultipleInSameSlot=true) |
Gets the amount of instances in the collection More... | |
int | GetCountInCategory (int categoryID, bool includeMultipleInSameSlot=true) |
Gets the amount of instances in the collection that represent an inventory item in a given category More... | |
bool | Contains (InvInstance invInstance) |
bool | Contains (int invID) |
InvInstance | GetFirstInstance (int invID) |
Gets the first-found inventory item instance in the collection that's associated with a specific inventory item More... | |
InvInstance | GetFirstInstance (string invName) |
Gets the first-found inventory item instance in the collection that's associated with a specific inventory item More... | |
InvInstance[] | GetAllInstances (int invID) |
Gets all inventory item instance in the collection that are associated with a specific inventory item More... | |
InvInstance[] | GetAllInstances (string invName) |
Gets all inventory item instance in the collection that are associated with a specific inventory item More... | |
int | GetTotalIntProperty (int propertyID) |
Gets the total value of all instances of an Integer inventory property (e.g. currency) within a set of inventory items. More... | |
int | GetTotalIntProperty (string propertyName) |
Gets the total value of all instances of an Integer inventory property (e.g. currency) within a set of inventory items. More... | |
float | GetTotalFloatProperty (int propertyID) |
Gets the total value of all instances of an Float inventory property (e.g. weight) within a set of inventory items. More... | |
float | GetTotalFloatProperty (string propertyName) |
Gets the total value of all instances of an Float inventory property (e.g. weight) within a set of inventory items. More... | |
InvVar | GetPropertyTotals (int propertyID) |
Gets the total amount of given integer or float inventory property, found in the current inventory More... | |
InvInstance[] | GetInstancesInCategory (int categoryID) |
Gets an array of all carried inventory items in a given category More... | |
bool | IsPlayerInventory () |
Container | GetSourceContainer () |
Static Public Member Functions | |
static InvCollection | LoadData (string data) |
Properties | |
List< InvInstance > | InvInstances [get] |
List< InvItem > | InvItems [get] |
int | MaxSlots [get, set] |
This class stores a list of InvInstance (inventory item instances), and has functions to manage them.
AC.InvCollection.InvCollection | ( | ) |
The default Constructor
AC.InvCollection.InvCollection | ( | List< InvItem > | invItems | ) |
A Constructor that populates itself with default inventory data
AC.InvCollection.InvCollection | ( | List< InvInstance > | _invInstances, |
bool | allowEmptySlots = false |
||
) |
A Constructor that populates itself based on an existing list of inventory item instances.
_invInstances | A List of InvInstances that represent the items to be added |
allowEmptySlots | If True, then invalid or empty entries in the _invInstances List will be included and used to add empty slots, rather than removed |
AC.InvCollection.InvCollection | ( | Container | container | ) |
A Constructor that populates itself based on a Container's default set of items
InvInstance AC.InvCollection.Add | ( | InvInstance | addInstance, |
bool | matchPropertiesWhenMerging = true |
||
) |
Adds an inventory item instance to the collection. If the item exists in another collection, it will be removed from there automatically.
addInstance | The inventory item instance to add |
InvInstance AC.InvCollection.AddToEnd | ( | InvInstance | addInstance | ) |
Adds an inventory item instance to the end of the collection - or the first-available empty slot. If the item exists in another collection, it will be removed from there automatically.
addInstance | The inventory item instance to add |
bool AC.InvCollection.Contains | ( | int | invID | ) |
Checks if the collection contains an inventory instance associated with a given inventory item
bool AC.InvCollection.Contains | ( | InvInstance | invInstance | ) |
Checks if the collection contains a given inventory instance
void AC.InvCollection.Delete | ( | int | itemID, |
int | amount | ||
) |
Deletes a set number of inventory item instances
itemID | The ID of the inventory item to delete |
amount | The amount to delete |
void AC.InvCollection.Delete | ( | InvInstance | invInstance | ) |
Deletes a given inventory item instance, provided it is a part of this collection
invInstance | The inventory item instance to delete |
void AC.InvCollection.Delete | ( | InvInstance | invInstance, |
int | amount | ||
) |
Deletes a given inventory item instance, provided it is a part of this collection
invInstance | The inventory item instance to delete |
amount | The amount to delete |
void AC.InvCollection.DeleteAll | ( | ) |
Deletes all item instances in the collection
void AC.InvCollection.DeleteAllInCategory | ( | int | categoryID | ) |
Deletes all item instances in a specific category
categoryID | The ID of the category to remove items from |
void AC.InvCollection.DeleteAllOfType | ( | int | itemID | ) |
Deletes all inventory item instances associated with a given inventory item
itemID | The ID of the inventory item to delete |
void AC.InvCollection.DeleteAtIndex | ( | int | index, |
int | amount | ||
) |
Deletes a set number of inventory item instances at a given index
index | The index to delete from |
amount | The amount to delete |
void AC.InvCollection.DeleteRecipeIngredients | ( | Recipe | recipe | ) |
Deletes all item instances that make up a recipe's ingredients
recipe | The recipe to delete ingredients from |
InvInstance [] AC.InvCollection.GetAllInstances | ( | int | invID | ) |
Gets all inventory item instance in the collection that are associated with a specific inventory item
invID | The ID of the inventory item |
InvInstance [] AC.InvCollection.GetAllInstances | ( | string | invName | ) |
Gets all inventory item instance in the collection that are associated with a specific inventory item
invName | The nameof the inventory item |
int AC.InvCollection.GetCount | ( | bool | includeMultipleInSameSlot = true | ) |
Gets the amount of instances in the collection
includeMultipleInSameSlot | If True, then the result will account for multiple amounts of an item in a single slot |
int AC.InvCollection.GetCount | ( | int | invID, |
bool | includeMultipleInSameSlot = true |
||
) |
Gets the amount of instances in the collection that represent a given inventory item
invID | The inventory item's ID number |
includeMultipleInSameSlot | If True, then the result will account for multiple amounts of the item in a single slot |
int AC.InvCollection.GetCountInCategory | ( | int | categoryID, |
bool | includeMultipleInSameSlot = true |
||
) |
Gets the amount of instances in the collection that represent an inventory item in a given category
categoryID | The category's ID number. |
includeMultipleInSameSlot | If True, then the result will account for multiple amounts of the item in a single slot |
InvInstance AC.InvCollection.GetFirstInstance | ( | int | invID | ) |
Gets the first-found inventory item instance in the collection that's associated with a specific inventory item
invID | The ID number of the inventory item |
InvInstance AC.InvCollection.GetFirstInstance | ( | string | invName | ) |
Gets the first-found inventory item instance in the collection that's associated with a specific inventory item
invName | The name of the inventory item |
InvInstance AC.InvCollection.GetInstanceAtIndex | ( | int | index | ) |
Gets the inventory item instance in the collection at a given index
index | The index to get |
InvInstance [] AC.InvCollection.GetInstancesInCategory | ( | int | categoryID | ) |
Gets an array of all carried inventory items in a given category
categoryID | The ID number of the category in question |
InvVar AC.InvCollection.GetPropertyTotals | ( | int | propertyID | ) |
Gets the total amount of given integer or float inventory property, found in the current inventory
propertyID | The ID of the integer or float inventory property |
string AC.InvCollection.GetSaveData | ( | ) |
Generates a single string that represents the class's saveable data
Container AC.InvCollection.GetSourceContainer | ( | ) |
Gets the Container that this collection represents, if appropriate
float AC.InvCollection.GetTotalFloatProperty | ( | int | propertyID | ) |
Gets the total value of all instances of an Float inventory property (e.g. weight) within a set of inventory items.
propertyID | The ID number of the Inventory property (see InvVar) to get the total value of |
float AC.InvCollection.GetTotalFloatProperty | ( | string | propertyName | ) |
Gets the total value of all instances of an Float inventory property (e.g. weight) within a set of inventory items.
propertyName | The name of the Inventory property (see InvVar) to get the total value of |
int AC.InvCollection.GetTotalIntProperty | ( | int | propertyID | ) |
Gets the total value of all instances of an Integer inventory property (e.g. currency) within a set of inventory items.
propertyID | The ID number of the Inventory property (see InvVar) to get the total value of |
int AC.InvCollection.GetTotalIntProperty | ( | string | propertyName | ) |
Gets the total value of all instances of an Integer inventory property (e.g. currency) within a set of inventory items.
propertyName | The name of the Inventory property (see InvVar) to get the total value of |
int AC.InvCollection.IndexOf | ( | InvInstance | invInstance | ) |
Gets the index of a given inventory item instance
InvInstance AC.InvCollection.Insert | ( | InvInstance | addInstance, |
int | index, | ||
OccupiedSlotBehaviour | occupiedSlotBehaviour = OccupiedSlotBehaviour.ShiftItems , |
||
bool | matchPropertiesWhenMerging = true |
||
) |
Inserts an inventory item instance into a specific index in the collection. If the item exists in another collection, it will be removed from there automatically.
addInstance | The inventory item instance to add |
index | The index to insert the item at |
occupiedSlotBehaviour | How to react if the intended index is already occupied by another item instance. |
bool AC.InvCollection.IsPlayerInventory | ( | ) |
Checks if this collection represents the player's inventory
|
static |
Create a new class isntance based on a serialised data string generated by the GetSaveData function
void AC.InvCollection.Transfer | ( | int | invID, |
InvCollection | fromCollection | ||
) |
Transfer all counts of a given inventory item from another collection
invID | The ID of the inventory item (InvItem) to transfer |
fromCollection | The collection to transfer from |
void AC.InvCollection.Transfer | ( | int | invID, |
InvCollection | fromCollection, | ||
int | amount, | ||
bool | matchPropertiesWhenMerging = true |
||
) |
Transfer a set count of a given inventory item from another collection
invID | The ID of the inventory item (InvItem) to transfer |
fromCollection | The collection to transfer from |
amount | The amount of items to transfer |
matchPropertiesWhenMerging | If True, then the property values of two slots that represent the same item must match for them to merge |
void AC.InvCollection.Transfer | ( | InvInstance | invInstance, |
InvCollection | fromCollection | ||
) |
Transfer all counts of a given inventory item from another collection
invInstance | The instance of the inventory item (InvItem) to transfer |
fromCollection | The collection to transfer from |
void AC.InvCollection.Transfer | ( | InvInstance | invInstance, |
InvCollection | fromCollection, | ||
int | amount, | ||
bool | matchPropertiesWhenMerging = true |
||
) |
Transfer a set count of a given inventory item from another collection
invInstance | The instance of the inventory item to transfer |
fromCollection | The collection to transfer from |
amount | The amount of items to transfer |
matchPropertiesWhenMerging | If True, then the property values of two slots that represent the same item must match for them to merge |
void AC.InvCollection.TransferAll | ( | InvCollection | fromCollection | ) |
Transfers all items from another collection
fromCollection | The collection of inventory item instances to transfer from |
|
get |
All Inventory item instances in the collection
|
get |
A list of all Inventory Items represented in the collection.
|
getset |
If > 0, the maximum number of slots the collection has to store items