Database decoder – Raven Rock Trial

Database decoder – Raven Rock Trial

This code was designed to take the information gotten from the XML into the correct rooms filled with the correct items and displaying the correct text. It was made in Raven Rock Trial, my first unity game made in a group.

Database code 1

In this part of code I just set all variables, find the position where the I have to spawn the room and find the stat list.

Database code 2

In the first tab we have the close code to close the game and the function to update the stats via eval java script, using the following code:

static public function useString(Target:Object, command:String, Commander:Object){
eval(command);
}

The first two functions in the second tab get the two options and put them in either of the option spot, this I random to make it that players have to read and by just clicking will get different things all together.

The last function is getting the option you picked and based on that and the information that the xml will change your stats.

Database code 3

This code snippet is all about the way how I show the text on the screen.

Database code 4

This code is in charge of switching the rooms and asking for the smaller functions. It get all the rooms in a list and gives the options to that same list.

Database code 5

These last functions are in charge of the things in the room. The roomSetPosition function decides what has to be in the room at what position. The addRoomStory function gets the info of the story and stores that in the list.  The SetStats function is giving the stat changes to the list while SetStatMust put the required stat you need to finish the good ending of that option in the list.