Hello Everyone,
I'm Litkey.
I am going to show how my inventory, loot table, item drops are made using Scriptable Objects.
I have seen the video about the Game Architecture using Scriptable Objects.
It was truely amazing that scriptable objects can be used as a reference sheet and it will never lose its reference unless it is deleted. Thus no need to worry about losing dependencies.
Although that doesn't mean I can apply that recipe to my game right away. So let me show you my NORMAL scriptable object use in my game.
LootTable:

Most people use scriptable objects as data container and so am I.
I made the Loot ID so that the enemies know which loot table to drop.

_lootID: used to find loot table
_lootTable: where it stores all the item drop informations
ItemDrop

Item Drop upon enemy's death is made using unity's transform
Since it is not very efficient later when more than 10+s of item drops will happen
I am planning to use Dotween to give a change.
Example:
DOTween.Sequence()
.Append(transform.DOBlendableMoveBy(Random.insideUnitCircle.normalized , 3f/Speed).SetEase(Ease.OutQuint))
.Join(transform.DOBlendableMoveBy(Vector3.up * JumpHeight, .5f/Speed).SetEase(Ease.OutExpo))
.Insert(.5f/Speed , transform.DOBlendableMoveBy(Vector3.down * JumpHeight, .5f/Speed).SetEase(Ease.OutBounce)) Inventory:

OnPointer(OnMouseButton): when player keep its press, it will show the item information of its item.
Items can be divided into Equippable item and Countable Items like portions.
Sort will sort the item based on its item type: Equippable item, Countable Item, etc.
InventoryUI.cs
it will take care of visuals of the inventory slots by getting data from Inventory.cs.
Inventory.cs
When item is added to inventory, it will be stored here as a data. Then it will update the Inventory UI which has reference to all ItemSlotUI.cs.
ItemSlotUI.cs
Stores the visual(sprite) component and gets managed by InventoryUI.cs.
Does not have reference to Inventory nor to the Inventory.UI.
'Game Devlog' 카테고리의 다른 글
| [Devlog] Lobby, MatchMaking, and Relay server (0) | 2022.10.20 |
|---|---|
| [Devlog] - 10/2/22 VolleyShot (Unity3D) (0) | 2022.10.03 |
| [Devlog] - 07/23/2022 (0) | 2022.07.24 |