|
Ok so I've got a simple puzzler game that I'm working on for my first College project with objects that I can pick up and everything is storing into an array and then I pack that array into a string and store it using PlayerPrefs. Everything is going fine so far but I've put together a simple spreadsheet of possible objects and what's required to use them etc etc. but I've no idea how to implement this in some sort of simple static database that I setup at the start. Would this be a hashtable thing ? I looked up hashtable in the script reference it seems to be a C# only thing (correct me if I'm wrong) - anyway I would just like to be able to check something against this 'database' like if I press the use button and I'm looking at door1, I need it to check the 'Requires' part of the database to see what is necessary to open the door. I'm sure you get the idea anyway - I've included a stripped down version of the database below. This is just the first 8 fields and 2 objects, I have a load more but just so it fits on the page and you get the idea I've shortened it. btw, in this table -1 means infinite
I could use PHP & MySQL (I'm quite comfortable at that) , but I want to make a simple standalone PC game to hand to my lecturer so he can test without too much effort on his part. I'm a bit lost with parsing XML so I'm hoping there's some simple way to implement this ?
(comments are locked)
|
|
Ok I'm sorry about this - I think I've figured out the obvious answer. Although relatively tedious, it will do for now while I get to grips with some of the .Net stuff. For the moment I've setup a simple script called InventoryItem.js -
and that script simply holds the info for each object and I just put in all the info manually into each object, and then I address this info using GetComponent - like this:
It will do for now, as it's only a very simple proof-of-concept project. In the meantime I will look into Dictionaries Hashtables etc.
(comments are locked)
|

Hashtables are not C# only. http://www.unifycommunity.com/wiki/index.php?title=Which_Kind_Of_Array_Or_Collection_Should_I_Use%3F
Thanks Eric. after a bit of fresh air and a bit of research I did figure some of this out. However the link you sent is very informative. Thanks again!