#RPG Item System

1 messages · Page 1 of 1 (latest)

stray hazel
#

Hello!
I am now working on my project, which is a survive game. There is a sub-system is collecting items from a scene, like flashbang, bandage, empty bottle, etc. And the player is allowed to use those items during the combat, which is another individual scene. Now, I am using a dictionary to record item info, the key is the item type, and the value is the count of corresponding item. My question is: Is it better to add a static int variable in each item script, like named "count", to record the number of each item? I am not sure if the variation of dictionary would cost more performance at runtime?

#

Here is how the system updates item count.

gritty sparrow
#

[]cb

terse mapleBOT
#

Use codeblocks to send code in a message!

To make a codeblock, surround your code with ```
To use C# syntax highlighting add cs after the three back ticks.

For example:
```cs
Console.WriteLine("Hello World");
```

Produces:

Console.WriteLine("Hello World");

To send lengthy code, paste it into https://paste.myst.rs/ and send the link of the paste into chat.

stray hazel