-
-
Notifications
You must be signed in to change notification settings - Fork 8
Equipment Component
In our game, characters can wear or use various equipment like armor, weapons, and gadgets. The Equipment Component acts like the character's personal gear manager, handling the equipping and unequipping of these items.
When your character decides to equip an item, such as a sword or a helmet, here's what happens:
-
Check Authority: The game first verifies if it's allowed to perform the equip action, similar to asking, "Can I wear this?"
-
Equip the Item:
- If the selected slot is empty, the item is placed there.
- If the slot is already occupied, the current item is unequipped, and the new item takes its place.
-
Notify the Game: The game then records this change, effectively telling your character, "You have a new item equipped!"
When your character decides to remove an item:
-
Check Authority: Like equipping, the game checks if it can remove the item from the equipment slot.
-
Remove the Item: The item is taken off and either placed back into the inventory or discarded.
-
Notify the Game: The game updates its records to reflect that the item is no longer equipped.
- Server: Acts as the central system, ensuring the game's rules are followed.
- Client: Your view of the game, where you interact with the game world.
When equipping or unequipping items, your game (client) requests these actions from the server. The server confirms these actions, ensuring consistency across all players' experiences.
The Equipment Component is vital for managing a character's gear, ensuring the actions of equipping and unequipping are smoothly executed and recognized across the game network.
graph TD
A[Start] -->|Function Call| B[EquipItem_Implementation]
B -->|Validate Request| C[Check Authority]
C -->|No Authority| D[EquipItem_Server]
C -->|Has Authority| E[Execute Equip Logic]
E -->|Find Target Slot| F[Slot Found]
F -->|Slot Empty| G[Equip in Empty Slot]
F -->|Slot Occupied| H[UnEquip Current Item]
G --> I[OnSlotEquipped Broadcast]
H --> I
I -->|Client-side Event| I2[PostItemEquipped_Client]
D -.->|Network Communication| E
A -->|Function Call| J[UnEquipItem_Implementation]
J -->|Validate Request| K[Check Authority]
K -->|No Authority| L[UnEquipItem_Server]
K -->|Has Authority| M[Execute UnEquip Logic]
M -->|Find Target Slot| N[Slot Found]
N -->|Perform UnEquip| O[OnSlotUnEquipped Broadcast]
O -->|Client-side Event| O2[PostItemUnEquipped_Client]
L -.->|Network Communication| M
graph TD
A[Start] -->|Function Call| B[FindSlotForItem]
B -->|Search Slot for Item| C[Return Slot ID or INVALID_SLOT]
A2[Start] -->|Function Call| D[FindSlotByID]
D -->|Search Slot by ID| E[Return Slot Index or INDEX_NONE]
A3[Start] -->|Function Call| F[CanEquipItem]
F -->|Check Equip Feasibility| G[Return True or False]
A4[Start] -->|Function Call| H[CanUnEquipItem]
H -->|Check UnEquip Feasibility| I[Return True or False]
A5[Start] -->|Function Call| J[GetAllSlots]
J -->|Retrieve All Slots| K[Return Slot Array]
A6[Start] -->|Function Call| L[IsItemEquipped]
L -->|Check If Item Is Equipped| M[Return True or False]
- Home
-
- Components
-
- Objects
-
- Settings
-
-
- Inventory & Equipment Settings
-
-
-
-
- Theme Config
-
-
-
-
-
-
- Content Theme Config
-
-
-
-
-
- Inventory & Equipment Settings (Editor)
-
- Event's System