Hello there!
The last days i fooled around with PlayMaker, looked up the Actions, this Forum and now i'm feeling (in some degree) confident; at least i can handle the most "problems" by myself by now.
Now, i don't have really a problem, but would like to hear from you, if this is a good approach for an Inventory-System, so here is the setup:
- My Inventory is based on nGUI
- This Inventory contains three Sprite-Objects (only SpriteObjects, no Buttons, nothing):
- - a 2x2 Grid- Spriteobject
- - a Note-Spriteobject
- - a Sticker-Spriteobject which hold the Note to the Grid
So. Within this Grid:
I have placed four empty GameObjects (Slot 1 - 4), one in each of the Gridfields center. So, if the Player walks around and picks up an item, it will be a child of one these Slots. At the moment, i am doing this:
- if the Player picks an Item up, a Prefab-Version (as a Button) of that item will be created at a certain Slot and this Slot will be made it's parent
But, first of all i have to check if one the Slots is available. I am checking this by
the "GameObject Has Children"-Action:
Then i make a "Bool Test" of the Stored Variable. If it is true, i am sending a certain Event to the InventoryMenu. If it is false, it goes to the next "Slottester" and so on.
In the InventoryMenu i run again a BoolTest (for certain reasons) and then the Item-Prefab is created:
It's working, really good. Worked it today and and tested it. But i am looking in further development and started thinking. Is this the best approach? You see, if i keep doing it this way, i have to make for every single item the Player may pick up this State-Cycle; i.e.
- every Item sends a unique Event to the Inventory Menu, which will make my InventoryMenu-FSM a biiiig FSM
- every Item has this certain Statepattern (which is not confusing at all)
Now i don't know if this is a good or bad approach and would like to hear some opinions.
In fact I started to think using ArrayMaker, but i don't have a clue where to begin with this "System" with Arrays.