How should I Manage my elements?

I am working on a game where the player can choose an element and use it to fight.

I made an abstract "Element" class where I can make 4 subclasses for each element.
I am very unsure how should I Manage them in the game.

for example if a player decides to left click I need to play a different animation to each element, and on code I can put a general script that checks the element and calls the right animation to start it, or I can spawn the element as an invisible object and run the animation code on the object and than make it visible when the animation is finished.

I am looking for different approaches to this as each element has different abillities or different spawning ways and I am not sure where to run the code.

Thanks!

Sounds a bit like an inventory to me.

These things (character customization, inventories, shop systems) are fairly tricky hairy beasts, definitely deep in advanced coding territory. They contain elements of:

  • a database of items that you may possibly possess / equip
  • a database of the items that you actually possess / equip currently
  • perhaps another database of your "storage" area at home base?
  • persistence of this information to storage between game runs
  • presentation of the inventory to the user (may have to scale and grow, overlay parts, clothing, etc)
  • interaction with items in the inventory or on the character or in the home base storage area
  • interaction with the world to get items in and out
  • dependence on asset definition (images, etc.) for presentation

Just the design choices of an inventory system can have a lot of complicating confounding issues, such as:

  • can you have multiple items? Is there a limit?
  • are those items shown individually or do they stack?
  • are coins / gems stacked but other stuff isn't stacked?
  • do items have detailed data shown (durability, rarity, damage, etc.)?
  • can users combine items to make new items? How? Limits? Results? Messages of success/failure?
  • can users substantially modify items with other things like spells, gems, sockets, etc.?
  • does a worn-out item (shovel) become something else (like a stick) when the item wears out fully?
  • etc.

Your best bet is probably to write down exactly what you want feature-wise. It may be useful to get very familiar with an existing game so you have an actual example of each feature in action.

Once you have decided a baseline design, fully work through two or three different inventory tutorials on Youtube, perhaps even for the game example you have chosen above.

Or... do like I like to do: just jump in and make it up as you go. It is SOFT-ware after all... evolve it as you go! :)

Breaking down a large problem such as inventory:

https://discussions.unity.com/t/826141/4

[quote=“Kurt-Dekker”, post:2, topic: 891216]
Sounds a bit like an inventory to me.
[/quote]
Doesn’t sound anything like an inventory to me, it sounds like socketing behaviour is the crux of this problem.

OP, this kinda of thing can probably be best set up by socketing behaviour with scriptable objects. There’s a number of tutorials out there that describe how this can be accomplished.

1 Like