Demo2 Loot
Examples/Demo2 Loot/LootDemo.unity
This is an example of a slot-indexed inventory and a connection between the game world, events, and UI.
What The Demo Shows
- chests as interactive world objects
- separate bindings for player and chest
- switching different data sources for DataBinding
- pickup/drop scenarios connected to the world
- the world does not know about UI directly
How It Is Structured
The key point is that Chest and PlayerInteraction live in the game world and do not
know about concrete UI panels. UI opening and binding are handled by LootUIController.
How It Works
Opening a chest:
PlayerInteractionfinds anIInteractable.- The player action calls
Interact(...). Chestchanges state and publishes an event.LootUIControllerreceives the event.- The controller activates the panel and calls
BindToChest(...). ChestInventoryDataBindingloads chest contents into UI.
Moving items:
- The player drags items between player inventory and chest inventory.
- The standard transfer pipeline performs the transfer.
- After successful commit, bindings update
ChestandPlayerInventoryData.
When To Use This Example
- you need chests opened through interaction
- you need an example of separating game-world logic from inventory UI