Class ItemMapsSample
This class manages the scene and serves as an example for item map.
Inherited Members
Namespace: UnityEngine.GameFoundation.Sample
Syntax
public class ItemMapsSample : MonoBehaviour
Fields
addItemButton
References to the remove buttons to enable/disable when the action is not possible.
Declaration
public Button addItemButton
Field Value
Type | Description |
---|---|
Button |
instructionsText
Text box containing initial instructions which are hidden to show items.
Declaration
public Text instructionsText
Field Value
Type | Description |
---|---|
Text |
itemsText
Text field for each ItemMap's contents.
Declaration
public Text[] itemsText
Field Value
Type | Description |
---|---|
Text[] |
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 |
removeAllButton
Declaration
public Button removeAllButton
Field Value
Type | Description |
---|---|
Button |
removeItemButton
Declaration
public Button removeItemButton
Field Value
Type | Description |
---|---|
Button |
toggleItemMap1Buttons
Declaration
public Button[] toggleItemMap1Buttons
Field Value
Type | Description |
---|---|
Button[] |
toggleItemMap2Buttons
Declaration
public Button[] toggleItemMap2Buttons
Field Value
Type | Description |
---|---|
Button[] |
toggleItemMap3Buttons
Declaration
public Button[] toggleItemMap3Buttons
Field Value
Type | Description |
---|---|
Button[] |
Methods
CreateItem()
Creates a single unique item in main inventory.
Declaration
public void CreateItem()
DeleteAll()
Deletes all items from the Inventory.
Declaration
public void DeleteAll()
DeleteItem()
Deletes a single item from the main inventory.
Declaration
public void DeleteItem()
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()
ToggleItemInMap(Int32, Int32)
Toggles specified slot in specified ItemMap.
Declaration
public void ToggleItemInMap(int mapIndex, int slotIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | mapIndex | Map index (0-2) to toggle item within. |
Int32 | slotIndex | Slot index (0-2) to modify. |
ToggleItemInMap1(Int32)
Button callback to toggle an item in map 1.
Declaration
public void ToggleItemInMap1(int slotIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | slotIndex | Slot index to toggle. |
ToggleItemInMap2(Int32)
Button callback to toggle an item in map 2.
Declaration
public void ToggleItemInMap2(int slotIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | slotIndex | Slot index to toggle. |
ToggleItemInMap3(Int32)
Button callback to toggle an item in map 3.
Declaration
public void ToggleItemInMap3(int slotIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | slotIndex | Slot index to toggle. |