Need guidance

Updated on May 9, 2018 in [A] Unity Scripting
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
4 on May 9, 2018

I want someone to point me in the right direction not code for me.

So what i want is my character to be able to hit/ shoot something for example like a tree and then increase my wood by 1 and be able to use that to create structures in game. Like how in fortnite when you hit something you get wood, and then can use that wood to create items.

 

  • Liked by
Reply
1 on May 9, 2018

A good place to start is to design out your inventory system and what it can hold and how you want to add items to it. Then you would need to define what kind of items it can hold. Once you can get that down then you can worry about the problem of hitting a tree or building. Your inventory system should be functioning separately from those behaviours. Doing that will allow you to reuse it in later applications. If you have any questions about how to design it let me know and I would be happy to help.

on May 9, 2018

thank you so much, ill let you know if I need any help

Show more replies
  • Liked by
Reply
Cancel
1 on May 9, 2018

easiest way would be to have the thing you are going to hit, drop some gameobject representation that has a reference to something “meaningful” like a wood.

When this “meaningful” thing enters the players trigger volume you could add it to a list of “meaningful” things that the player defines.

When the player performs some action you could remove from that list and define some desirable result.

on May 9, 2018

This works too, but I don’t want the wood to drop, I want it to immediately go into my inventory

Show more replies
  • Liked by
Reply
Cancel