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?
#RPG Item System
1 messages · Page 1 of 1 (latest)
Here is how the system updates item count.
Here is the dictionary code:
https://paste.myst.rs/ltrqyzmp
a powerful website for storing and sharing text and code snippets. completely free and open source.
[]cb
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.
https://paste.myst.rs/ltrqyzmp Here is part of my code.
a powerful website for storing and sharing text and code snippets. completely free and open source.