Wednesday, 27 February 2013

GUI - Inventory or where the hell is my window gone



Since we are working on RPG game, we will be using a lot of GUI, therefore I am trying to come up with an InventoryScript for the game. Having a little experience from building a MainMenu scene based on GUI before, i thought this would be good opportunity to use knowledge i've learnt so far.

First I thought of using GUI.Box and simply draw buttons representing an empty slot in the inventory. After that I tried GUI.BeginGroup and moved everything inside some function which I called in Update function afterwards. Did not work anyway, also i have found out, that using a GUI.Buttons as an inventory slots is causing framerate to drop.

There is possibility to use a GUI.SelectionGrid and GUI.BringWindowToFront together with GUI.DragWindow. In a perfect world i would use two GUI.DragWindow with GUI.SelectionGrid. One for the Player's equipment 'armor, helmet,...' and second for actual inventory. But we are not living in perfect world, right and positioning wasn't that easy how i expected. 

The last but not the least is a use of 2Dimensional Arrays., this is actually approach which I am taking right now. I hope that somehow I will be able to move my inventory Array inside DragAble Window and have a freedom to move with it. I have got the basic skeleton for this it's just matter of time i think.

No comments:

Post a Comment