playMaker

Author Topic: Is possible to activate a child in a gameobject by getting info from XML ?  (Read 664 times)

markettounity

  • Playmaker Newbie
  • *
  • Posts: 29
Hi guys !

I have 5 gameobjects in the hierarchy representing arcade cabinets.

Each cabinet has an id number, a filename of the rom (Romfile), a child gameobject board for 1 or 2 players ( 1pl and 2pl) and a child gameobject bezel for the screen that changes horizontally and vertically (hor or ver).

I created an XML file called ArcadeList.xml structured as follows:

Code: [Select]
<Arcades>
   <Arcade id="01" romfile="gberet" cpo="1pl" bezel="hor" ></Arcade>
   <Arcade id="02" romfile="ffight" cpo="2pl" bezel="hor" ></Arcade>
   <Arcade id="03" romfile="19xx" cpo="2pl" bezel="ver" ></Arcade>
   <Arcade id="04" romfile="ghouls" cpo="1pl" bezel="hor" ></Arcade>
   <Arcade id="05" romfile="contra" cpo="2pl" bezel="ver" ></Arcade>
</Arcades>

Then i created an object in the hierarchy called XML within which I created an FSM and through the actions of datamaker I created 3 different hash tables:

1 - hashtable for bezels (hor and Ver)

2 - Hashtable for control panel (1pl and pl2)

3 - hashtable for romfiles

I would like that by inserting the romfile in a gameobject, the relative variants would be activated automatically, thus choosing 1pl or 2pl and bezel hor or ver extracting the relative data from the XML file , so for "gberet" activate "1pl" child, and activate "Hor" child, for "19xx" 2pl child and ver bezel and so on ...

Is it possible to do this? And how ??

Maybe i don't need the hash table ??

Thank you for your help !! :D

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Hi.
Maybe the video below can get you in the right direction.
Mainly the string switch part.
You could use the 'romfile/cpo/bezel' in there.

Then for cpo and bezel you could use another string switch for p1/p2 and hor/ver and set it as a bool inside the hashtable (for example false = p1 / true p2 | false = hor / true = ver)
Mainly because it will be easier to check with (hashtable bool test)

To do 3 hashtables like you mentioned is probably the best way, and use the 'id' as keys.


markettounity

  • Playmaker Newbie
  • *
  • Posts: 29
Hi !!

as always , thank you for your help !

I honestly didn't understand much of what you suggested ...

Now I will watch the video and try to understand more.

A question :

to do this, each object must have a hash table or can I work with a separate object with xml and hash table inside?