Skip to content
Dagait edited this page Apr 17, 2022 · 19 revisions

Items


More topics about Items:


To create a new Item, simply perform a right mouse button click in the project view in Unity-Engine. The default folder for all items is:

Asstes/Objects/Items/

In the menu go to:

  • Right Mouse button --> Create --> HamsterGame --> Items --> Item

The default name for a newly created item is "new Item", change this name to whatever name you want. Subsequently, click on the newly created item file, as a result, the inspector should look like this:

ItemInspector

To note:

  • Every Id is unique, keep this in mind if you want to change it.

Explanation of the properties:

Name Datatype Description
Id int Unique for each Item.
Name string This name is going to appear in-game. If you want to place this item in the world (Via the "Tile Palette"), you have to name the Tile like this string.
ItemImage sprite Picture for this Item, this picture is going to be displayed in the inventory and in the world. Not null!
Description string (Optional) Description for this item.
Type enum Equippable or Usable
CanChangeHamsterValues bool Can this Item influence values like Health and Endurance?
HealValue int Heal a specific amount of the hamsters' health.
DamageValue int Deal a specific amount of damage to the hamsters' health.
EnduranceHealValue int Heal a specific amount of the hamsters' endurance.
EnduranceDamageValue int Deal a specific amount of damage to the hamsters' endurance.
IsEquipment bool Can this Item be equipped? (Case: Type=Consumable, this bool is going to be ignored!)
EquipType enum None, Head, Hands, Foot, Extra 1, Extra 2 (Where to equip this item?)
BuyPrice int How much does this item cost to buy from another one?
SellPrice int How much will the buyer get, if he/she sells an item to the seller?
StackAmount int How many items can be stacked in one slot?
SlotId int Don't edit this value! On runtime, this value is going to be changed.
HasSpecialEffects bool Does this item owns some special effects?
MoveSpeed int Influence the steps the hamster can do for one move command.
OnEquip() UnityEvent What should happen, if the hamster is equipped with this item? Also, see Item Events for more information about events
OnUnequip() UnityEvent What should happen, if the hamster is no longer wearing this item? Also, see Item Events for more information about events
OnUse() UnityEvent What should happen, if the hamster uses this item? (Consumable) Also, see Item Events for more information about events

After you set up everything you have to add this item to the Manager, click on Hierarchy (Left-hand side) on the game object "Manager".

Inspector_Manager

On the right-hand side, you have to scroll down, until you find the component "Item Collection".

Inspector_Manager_ItemCollection

Click the "+" sign to add an item. That's it.