|
TopDown Engine v4.5
|
Example of how you can call an inventory from your game. I suggest having your Input and GUI manager classes handle that though. More...
Public Types | |
| enum | ManageButtonsModes { Interactable , SetActive } |
Public Member Functions | |
| virtual void | ToggleInventory () |
| Opens or closes the inventory panel based on its current status. | |
| virtual void | OpenInventory () |
| Opens the inventory panel. | |
| virtual void | CloseInventory () |
| Closes the inventory panel. | |
| virtual void | EquipOrUse () |
| When pressing the equip/use button, we determine which of the two methods to call. | |
| virtual void | Equip () |
| virtual void | Use () |
| virtual void | UnEquip () |
| virtual void | Move () |
| Triggers the selected slot's move method. | |
| virtual void | Drop () |
| Triggers the selected slot's drop method. | |
| virtual void | OnMMEvent (MMInventoryEvent inventoryEvent) |
| Catches MMInventoryEvents and acts on them. | |
| Public Member Functions inherited from MoreMountains.Tools.MMEventListener< T > | |
| void | OnMMEvent (T eventType) |
Public Attributes | |
| CanvasGroup | TargetInventoryContainer |
| The CanvasGroup containing all the elements you want to show/hide when pressing the open/close inventory button. | |
| InventoryDisplay | TargetInventoryDisplay |
| The main inventory display. | |
| CanvasGroup | Overlay |
| The Fader that will be used under it when opening/closing the inventory. | |
| float | OverlayActiveOpacity = 0.85f |
| the opacity of the overlay when active | |
| float | OverlayInactiveOpacity = 0f |
| the opacity of the overlay when inactive | |
| bool | HideContainerOnStart = true |
| if this is true, the inventory container will be hidden automatically on start | |
| bool | InputOnlyWhenOpen = true |
| if this is true, the inventory container will be hidden automatically on start | |
| KeyCode | ToggleInventoryKey = KeyCode.I |
| the key used to open/close the inventory | |
| KeyCode | ToggleInventoryAltKey = KeyCode.Joystick1Button6 |
| the alt key used to open/close the inventory | |
| KeyCode | OpenInventoryKey |
| the key used to open the inventory | |
| KeyCode | CloseInventoryKey |
| the key used to close the inventory | |
| KeyCode | CancelKey = KeyCode.Escape |
| the alt key used to open/close the inventory | |
| KeyCode | CancelKeyAlt = KeyCode.Joystick1Button7 |
| the alt key used to open/close the inventory | |
| string | MoveKey = "insert" |
| the key used to move an item | |
| string | MoveAltKey = "joystick button 2" |
| the alt key used to move an item | |
| string | EquipKey = "home" |
| the key used to equip an item | |
| string | EquipAltKey = "home" |
| the alt key used to equip an item | |
| string | UseKey = "end" |
| the key used to use an item | |
| string | UseAltKey = "end" |
| the alt key used to use an item | |
| string | EquipOrUseKey = "space" |
| the key used to equip or use an item | |
| string | EquipOrUseAltKey = "joystick button 0" |
| the alt key used to equip or use an item | |
| string | DropKey = "delete" |
| the key used to drop an item | |
| string | DropAltKey = "joystick button 1" |
| the alt key used to drop an item | |
| string | NextInvKey = "page down" |
| the key used to go to the next inventory | |
| string | NextInvAltKey = "joystick button 4" |
| the alt key used to go to the next inventory | |
| string | PrevInvKey = "page up" |
| the key used to go to the previous inventory | |
| string | PrevInvAltKey = "joystick button 5" |
| the alt key used to go to the previous inventory | |
| List< string > | CloseList |
| a list of other inventories that should get force-closed when this one opens | |
| bool | ManageButtons = false |
| if this is true, the InputManager will change the interactable state of inventory control buttons based on the currently selected slot | |
| ManageButtonsModes | ManageButtonsMode = ManageButtonsModes.SetActive |
| the selected mode to enable buttons with (interactable will change the button's interactable state, SetActive will enable/disable the button's game object | |
| Button | EquipUseButton |
| the button used to equip or use an item | |
| Button | MoveButton |
| the button used to move an item | |
| Button | DropButton |
| the button used to drop an item | |
| Button | EquipButton |
| the button used to equip an item | |
| Button | UseButton |
| the button used to use an item | |
| Button | UnEquipButton |
| the button used to unequip an item | |
| bool | InventoryIsOpen |
| if this is true, the associated inventory is open, closed otherwise | |
Protected Member Functions | |
| virtual void | Start () |
| On start, we grab references and prepare our hotbar list. | |
| virtual void | Update () |
| Every frame, we check for input for the inventory, the hotbars and we check the current selection. | |
| virtual void | CheckCurrentlySelectedSlot () |
| Every frame, we check and store what object is currently selected. | |
| virtual void | HandleButtons () |
| Will turn inventory controls interactable or not based on the currently selected slot, if ManageButtons is set to true. | |
| virtual void | SetButtonState (Button targetButton, bool state) |
| An internal method used to turn a button on or off. | |
| virtual void | HandleInventoryInput () |
| Handles the inventory related inputs and acts on them. | |
| virtual void | HandleHotbarsInput () |
| Checks for hotbar input and acts on it. | |
| virtual void | OnEnable () |
| On Enable, we start listening for MMInventoryEvents. | |
| virtual void | OnDisable () |
| On Disable, we stop listening for MMInventoryEvents. | |
Protected Attributes | |
| CanvasGroup | _canvasGroup |
| GameObject | _currentSelection |
| InventorySlot | _currentInventorySlot |
| List< InventoryHotbar > | _targetInventoryHotbars |
| InventoryDisplay | _currentInventoryDisplay |
| bool | _toggleInventoryKeyPressed |
| bool | _openInventoryKeyPressed |
| bool | _closeInventoryKeyPressed |
| bool | _cancelKeyPressed |
| bool | _prevInvKeyPressed |
| bool | _nextInvKeyPressed |
| bool | _moveKeyPressed |
| bool | _equipOrUseKeyPressed |
| bool | _equipKeyPressed |
| bool | _useKeyPressed |
| bool | _dropKeyPressed |
| bool | _hotbarInputPressed = false |
Properties | |
| virtual InventorySlot | CurrentlySelectedInventorySlot [get, set] |
| returns the active slot | |
Example of how you can call an inventory from your game. I suggest having your Input and GUI manager classes handle that though.
|
protectedvirtual |
Every frame, we check and store what object is currently selected.
|
virtual |
Closes the inventory panel.
|
virtual |
Triggers the selected slot's drop method.
|
virtual |
|
virtual |
When pressing the equip/use button, we determine which of the two methods to call.
|
protectedvirtual |
Will turn inventory controls interactable or not based on the currently selected slot, if ManageButtons is set to true.
|
protectedvirtual |
Checks for hotbar input and acts on it.
|
protectedvirtual |
Handles the inventory related inputs and acts on them.
|
virtual |
Triggers the selected slot's move method.
|
protectedvirtual |
On Disable, we stop listening for MMInventoryEvents.
|
protectedvirtual |
On Enable, we start listening for MMInventoryEvents.
|
virtual |
Catches MMInventoryEvents and acts on them.
| inventoryEvent | Inventory event. |
|
virtual |
Opens the inventory panel.
|
protectedvirtual |
An internal method used to turn a button on or off.
| targetButton | |
| state |
|
protectedvirtual |
On start, we grab references and prepare our hotbar list.
|
virtual |
Opens or closes the inventory panel based on its current status.
|
virtual |
|
protectedvirtual |
Every frame, we check for input for the inventory, the hotbars and we check the current selection.
|
virtual |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| KeyCode MoreMountains.InventoryEngine.InventoryInputManager.CancelKey = KeyCode.Escape |
the alt key used to open/close the inventory
| KeyCode MoreMountains.InventoryEngine.InventoryInputManager.CancelKeyAlt = KeyCode.Joystick1Button7 |
the alt key used to open/close the inventory
| KeyCode MoreMountains.InventoryEngine.InventoryInputManager.CloseInventoryKey |
the key used to close the inventory
| List<string> MoreMountains.InventoryEngine.InventoryInputManager.CloseList |
a list of other inventories that should get force-closed when this one opens
| string MoreMountains.InventoryEngine.InventoryInputManager.DropAltKey = "joystick button 1" |
the alt key used to drop an item
| Button MoreMountains.InventoryEngine.InventoryInputManager.DropButton |
the button used to drop an item
| string MoreMountains.InventoryEngine.InventoryInputManager.DropKey = "delete" |
the key used to drop an item
| string MoreMountains.InventoryEngine.InventoryInputManager.EquipAltKey = "home" |
the alt key used to equip an item
| Button MoreMountains.InventoryEngine.InventoryInputManager.EquipButton |
the button used to equip an item
| string MoreMountains.InventoryEngine.InventoryInputManager.EquipKey = "home" |
the key used to equip an item
| string MoreMountains.InventoryEngine.InventoryInputManager.EquipOrUseAltKey = "joystick button 0" |
the alt key used to equip or use an item
| string MoreMountains.InventoryEngine.InventoryInputManager.EquipOrUseKey = "space" |
the key used to equip or use an item
| Button MoreMountains.InventoryEngine.InventoryInputManager.EquipUseButton |
the button used to equip or use an item
| bool MoreMountains.InventoryEngine.InventoryInputManager.HideContainerOnStart = true |
if this is true, the inventory container will be hidden automatically on start
| bool MoreMountains.InventoryEngine.InventoryInputManager.InputOnlyWhenOpen = true |
if this is true, the inventory container will be hidden automatically on start
| bool MoreMountains.InventoryEngine.InventoryInputManager.InventoryIsOpen |
if this is true, the associated inventory is open, closed otherwise
| bool MoreMountains.InventoryEngine.InventoryInputManager.ManageButtons = false |
if this is true, the InputManager will change the interactable state of inventory control buttons based on the currently selected slot
| ManageButtonsModes MoreMountains.InventoryEngine.InventoryInputManager.ManageButtonsMode = ManageButtonsModes.SetActive |
the selected mode to enable buttons with (interactable will change the button's interactable state, SetActive will enable/disable the button's game object
| string MoreMountains.InventoryEngine.InventoryInputManager.MoveAltKey = "joystick button 2" |
the alt key used to move an item
| Button MoreMountains.InventoryEngine.InventoryInputManager.MoveButton |
the button used to move an item
| string MoreMountains.InventoryEngine.InventoryInputManager.MoveKey = "insert" |
the key used to move an item
| string MoreMountains.InventoryEngine.InventoryInputManager.NextInvAltKey = "joystick button 4" |
the alt key used to go to the next inventory
| string MoreMountains.InventoryEngine.InventoryInputManager.NextInvKey = "page down" |
the key used to go to the next inventory
| KeyCode MoreMountains.InventoryEngine.InventoryInputManager.OpenInventoryKey |
the key used to open the inventory
| CanvasGroup MoreMountains.InventoryEngine.InventoryInputManager.Overlay |
The Fader that will be used under it when opening/closing the inventory.
| float MoreMountains.InventoryEngine.InventoryInputManager.OverlayActiveOpacity = 0.85f |
the opacity of the overlay when active
| float MoreMountains.InventoryEngine.InventoryInputManager.OverlayInactiveOpacity = 0f |
the opacity of the overlay when inactive
| string MoreMountains.InventoryEngine.InventoryInputManager.PrevInvAltKey = "joystick button 5" |
the alt key used to go to the previous inventory
| string MoreMountains.InventoryEngine.InventoryInputManager.PrevInvKey = "page up" |
the key used to go to the previous inventory
| CanvasGroup MoreMountains.InventoryEngine.InventoryInputManager.TargetInventoryContainer |
The CanvasGroup containing all the elements you want to show/hide when pressing the open/close inventory button.
| InventoryDisplay MoreMountains.InventoryEngine.InventoryInputManager.TargetInventoryDisplay |
The main inventory display.
| KeyCode MoreMountains.InventoryEngine.InventoryInputManager.ToggleInventoryAltKey = KeyCode.Joystick1Button6 |
the alt key used to open/close the inventory
| KeyCode MoreMountains.InventoryEngine.InventoryInputManager.ToggleInventoryKey = KeyCode.I |
the key used to open/close the inventory
| Button MoreMountains.InventoryEngine.InventoryInputManager.UnEquipButton |
the button used to unequip an item
| string MoreMountains.InventoryEngine.InventoryInputManager.UseAltKey = "end" |
the alt key used to use an item
| Button MoreMountains.InventoryEngine.InventoryInputManager.UseButton |
the button used to use an item
| string MoreMountains.InventoryEngine.InventoryInputManager.UseKey = "end" |
the key used to use an item
|
getset |
returns the active slot