![]() |
Corgi Engine v9.3
|
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 More... | |
virtual void | OpenInventory () |
Opens the inventory panel More... | |
virtual void | CloseInventory () |
Closes the inventory panel More... | |
virtual void | EquipOrUse () |
When pressing the equip/use button, we determine which of the two methods to call More... | |
virtual void | Equip () |
virtual void | Use () |
virtual void | UnEquip () |
virtual void | Move () |
Triggers the selected slot's move method More... | |
virtual void | Drop () |
Triggers the selected slot's drop method More... | |
virtual void | OnMMEvent (MMInventoryEvent inventoryEvent) |
Catches MMInventoryEvents and acts on them More... | |
![]() | |
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. More... | |
InventoryDisplay | TargetInventoryDisplay |
The main inventory display. More... | |
CanvasGroup | Overlay |
The Fader that will be used under it when opening/closing the inventory. More... | |
float | OverlayActiveOpacity = 0.85f |
the opacity of the overlay when active More... | |
float | OverlayInactiveOpacity = 0f |
the opacity of the overlay when inactive More... | |
bool | HideContainerOnStart = true |
if this is true, the inventory container will be hidden automatically on start More... | |
bool | InputOnlyWhenOpen = true |
if this is true, the inventory container will be hidden automatically on start More... | |
KeyCode | ToggleInventoryKey = KeyCode.I |
the key used to open/close the inventory More... | |
KeyCode | ToggleInventoryAltKey = KeyCode.Joystick1Button6 |
the alt key used to open/close the inventory More... | |
KeyCode | OpenInventoryKey |
the key used to open the inventory More... | |
KeyCode | CloseInventoryKey |
the key used to close the inventory More... | |
KeyCode | CancelKey = KeyCode.Escape |
the alt key used to open/close the inventory More... | |
KeyCode | CancelKeyAlt = KeyCode.Joystick1Button7 |
the alt key used to open/close the inventory More... | |
string | MoveKey = "insert" |
the key used to move an item More... | |
string | MoveAltKey = "joystick button 2" |
the alt key used to move an item More... | |
string | EquipKey = "home" |
the key used to equip an item More... | |
string | EquipAltKey = "home" |
the alt key used to equip an item More... | |
string | UseKey = "end" |
the key used to use an item More... | |
string | UseAltKey = "end" |
the alt key used to use an item More... | |
string | EquipOrUseKey = "space" |
the key used to equip or use an item More... | |
string | EquipOrUseAltKey = "joystick button 0" |
the alt key used to equip or use an item More... | |
string | DropKey = "delete" |
the key used to drop an item More... | |
string | DropAltKey = "joystick button 1" |
the alt key used to drop an item More... | |
string | NextInvKey = "page down" |
the key used to go to the next inventory More... | |
string | NextInvAltKey = "joystick button 4" |
the alt key used to go to the next inventory More... | |
string | PrevInvKey = "page up" |
the key used to go to the previous inventory More... | |
string | PrevInvAltKey = "joystick button 5" |
the alt key used to go to the previous inventory More... | |
List< string > | CloseList |
a list of other inventories that should get force-closed when this one opens More... | |
bool | ManageButtons = false |
if this is true, the InputManager will change the interactable state of inventory control buttons based on the currently selected slot More... | |
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 More... | |
Button | EquipUseButton |
the button used to equip or use an item More... | |
Button | MoveButton |
the button used to move an item More... | |
Button | DropButton |
the button used to drop an item More... | |
Button | EquipButton |
the button used to equip an item More... | |
Button | UseButton |
the button used to use an item More... | |
Button | UnEquipButton |
the button used to unequip an item More... | |
bool | InventoryIsOpen |
if this is true, the associated inventory is open, closed otherwise More... | |
Protected Member Functions | |
virtual void | Start () |
On start, we grab references and prepare our hotbar list More... | |
virtual void | Update () |
Every frame, we check for input for the inventory, the hotbars and we check the current selection More... | |
virtual void | CheckCurrentlySelectedSlot () |
Every frame, we check and store what object is currently selected More... | |
virtual void | HandleButtons () |
Will turn inventory controls interactable or not based on the currently selected slot, if ManageButtons is set to true More... | |
virtual void | SetButtonState (Button targetButton, bool state) |
An internal method used to turn a button on or off More... | |
virtual void | HandleInventoryInput () |
Handles the inventory related inputs and acts on them. More... | |
virtual void | HandleHotbarsInput () |
Checks for hotbar input and acts on it More... | |
virtual void | OnEnable () |
On Enable, we start listening for MMInventoryEvents More... | |
virtual void | OnDisable () |
On Disable, we stop listening for MMInventoryEvents More... | |
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 [getset] |
returns the active slot More... | |
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