Class InventoryBasics
This class manages the scene and serves as an example for inventory basics.
Inherited Members
Namespace: UnityEngine.GameFoundation.Sample
Syntax
public class InventoryBasics : MonoBehaviour
Fields
addAppleButton
References to the remove buttons to enable/disable when the action is not possible.
Declaration
public Button addAppleButton
Field Value
Type | Description |
---|---|
Button |
addOrangeButton
Declaration
public Button addOrangeButton
Field Value
Type | Description |
---|---|
Button |
mainText
We will need a reference to the main text box in the scene so we can easily modify it.
Declaration
public Text mainText
Field Value
Type | Description |
---|---|
Text |
removeAllApplesButton
Declaration
public Button removeAllApplesButton
Field Value
Type | Description |
---|---|
Button |
removeAllOrangesButton
Declaration
public Button removeAllOrangesButton
Field Value
Type | Description |
---|---|
Button |
removeAppleButton
Declaration
public Button removeAppleButton
Field Value
Type | Description |
---|---|
Button |
removeOrangeButton
Declaration
public Button removeOrangeButton
Field Value
Type | Description |
---|---|
Button |
Methods
AddFruit(String)
Adds a single fruit to the main inventory.
Declaration
public void AddFruit(string fruitItemDefinitionKey)
Parameters
Type | Name | Description |
---|---|---|
String | fruitItemDefinitionKey |
OnGameFoundationException(Exception)
If GameFoundation throws exception, log the error to console.
Declaration
public void OnGameFoundationException(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | Exception thrown by GameFoundation. |
OnGameFoundationInitialized()
Once Game Foundation completes initialization, we enable buttons, setup callbacks, update GUI, etc.
Declaration
public void OnGameFoundationInitialized()
RemoveAllFruitType(String)
Removes all instances of specified fruit from the Inventory.
Declaration
public void RemoveAllFruitType(string fruitDefinitionKey)
Parameters
Type | Name | Description |
---|---|---|
String | fruitDefinitionKey |
RemoveFruit(String)
Removes a single fruit from the main inventory.
Declaration
public void RemoveFruit(string fruitItemDefinitionId)
Parameters
Type | Name | Description |
---|---|---|
String | fruitItemDefinitionId |