Items in Pirates of Voxel Play rely on the ItemDefinition objects provided by Voxel Play.
In the Pirates of Voxel Play, the available items are inside the PirateIsland/Items folder. In the screenshot below, you can see the resources of the Pistol item:
When you select the item, the following info appears in the inspector:
Please refer to the Item Definitions in Voxel Play for more information about this kind of objects.
Each item definition allows a certain number of custom properties. These are a list of labels plus a value that you can add to the item definition to store certain attributes or information. In this case, the pistol weapon uses the hitDamage, hitRange, hitDelay and weaponType properties. You can change these values to make a weapon inflict more or less damage or modify its hit range for example.
The Icon Prefab is used to specify which prefab to load when the item is held in the character hand. The gameobject shown in the character hand is an instance of that prefab.
When the item is dropped to the ground or thrown away, the prefab specified below "Can Be Picked" is used.
If we open the "Pistol_Pickup_Network" prefab, we get this structure:
In Pirates of Voxel Play, we assign all items to the PickUps layer except the SphereTrigger object which must be a child of the item root. This special collider is a trigger which reacts when player approaches it and is used to initiate the pick up of the item.
All items are named "_PickUp_Network" to reflect two aspects:
- They have this SphereTrigger to initiate the pick up.
- They have a NetworkItem component attached to it, as well as a NetworkIdentity and NetworkTransform so Mirror syncs their transforms across all clients.
The NetworkItem component contains additional details about the item itself and controls some aspects of the spawned item like which item definition represents that gameobject or reacting to the trigger so it adds to the player when he/she approaches to the item gameobject.
Mobs and Chest Loot
You can customize the loot dropped by mobs when they're killed or found in chests.
Go to Game/Scripts/Mobs folder and select the mob you want to customize, for example a Cannibal.
Please check the Customizing Mobs for more details about the mob configuration fields.