Class InventoryItemDefinition
Preset values and rules for an InventoryItem. During runtime, it may be useful to refer back to the InventoryItemDefinition for the presets and rules, but the values cannot be changed at runtime. InventoryItemDefinitions are also used as factories to create InventoryItems.
Inherited Members
Namespace: UnityEngine.GameFoundation
Syntax
public class InventoryItemDefinition : TradableDefinition, IEquatable<CatalogItem>, IComparable<CatalogItem>
Methods
GetDefaultValueOfMutableProperty(String)
Get the default value of the mutable property with the given propertyKey
.
Declaration
public Property GetDefaultValueOfMutableProperty(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | Identifier of the mutable property to get the value of. |
Returns
Type | Description |
---|---|
Property | The default value of the mutable property with the given |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if the given |
PropertyNotFoundException | Thrown if there is no mutable property with the given |
GetDefaultValuesOfMutableProperties()
Get all default properties stored in this definition.
Declaration
public Dictionary<string, Property> GetDefaultValuesOfMutableProperties()
Returns
Type | Description |
---|---|
Dictionary<String, Property> | Return a new dictionary containing all properties stored in this definition. The returned dictionary is never null. |
GetDefaultValuesOfMutableProperties(Dictionary<String, Property>)
Get all default values of mutable properties stored in this definition.
Declaration
public void GetDefaultValuesOfMutableProperties(Dictionary<string, Property> target)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<String, Property> | target | The dictionary to fill with the mutable properties stored in this definition. It is cleared before being filled. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the given |
HasMutableProperty(String)
Check if this definition has a mutable property with the given propertyKey
.
Declaration
public bool HasMutableProperty(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | The identifier of the mutable property to look for. |
Returns
Type | Description |
---|---|
Boolean |
|
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if the given |
TryGetDefaultValueOfMutableProperty(String, out Property)
Try to get the default value of the mutable property with the given propertyKey
.
Declaration
public bool TryGetDefaultValueOfMutableProperty(string propertyKey, out Property property)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | Identifier of the mutable property to get the value of. |
Property | property | The default value of the searched mutable property, if found. |
Returns
Type | Description |
---|---|
Boolean | Returns true if a mutable property with the given |