playMaker

Author Topic: need help building radio button logic  (Read 5459 times)

shsha

  • Playmaker Newbie
  • *
  • Posts: 8
need help building radio button logic
« on: January 10, 2012, 07:15:52 AM »
hi all
I'm doing presentation of products and I want to press the button appears on the product and the rest disappear .. How can this work
 
i mean how to control show/hide objects in real time by press buttons

thnax
« Last Edit: July 23, 2012, 03:57:53 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: need help...
« Reply #1 on: January 10, 2012, 10:14:41 AM »
Hi,

 It's simple to show hide an object. there is a custom action for this:
https://hutonggames.fogbugz.com/default.asp?W686

So:

Create button using https://hutonggames.fogbugz.com/default.asp?W508 that when the user press sends an event "TOGGLE VISIBILITY" for example and goes to another where where  you user "set visibility" action  and set the "toggle" to true ( and set "reset on exit" to false if want the visibilty state to persists).

 I made screenshots of the various fsm elements.

 if you are having trouble with actually understanding how it all fits together, I'll do a screencast to explain the process and build it from scratch.

Starts from there. In order to hide all other object, It would be slightly more advanced. Are you confortable with what I explained above?

Bye,

 Jean

« Last Edit: January 10, 2012, 10:16:27 AM by jeanfabre »

shsha

  • Playmaker Newbie
  • *
  • Posts: 8
Re: need help...
« Reply #2 on: January 11, 2012, 04:12:13 AM »
thanx alot it`s so nice of u ....

but how i can to control many objects for example .... three buttons every button has a name like chair , desk , sofa ..

i wana press button chair to show the chair only & hide the other objects ....

& when press button desk `ll show the desk only & hide the othere objects ..... etc.

hope u get what i mean ... thanx

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: need help...
« Reply #3 on: January 11, 2012, 05:51:33 AM »
Hi,

 if you want to control and hide all others object, you will simply need to send a global event, for example "HIDE". Using the send event action , you can ignore self, so every fsm will get it but the one who sends it, so it's perfect for your case.

so, create in the same fsm, a new state called "hide", create a global event called "HIDE" plug to the "hide" state a global transition and select "HIDE". then when you toggle, you check if the object is now visible or not, and if visible, you fire the "HIDE" event to all ( but yourself) and you are done.

now, every object that implemented "HIDE" will receive this call and can hide themselves.

 Do you think you can implement this or do you need an example?

 Bye,

 Jean

shsha

  • Playmaker Newbie
  • *
  • Posts: 8
Re: need help...
« Reply #4 on: January 18, 2012, 07:36:11 AM »
sorry i do`t get it .... i`m still try to learn playmaker
can u put a pic or simple example if u plz

thanx alot

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: need help...
« Reply #5 on: January 19, 2012, 01:18:18 AM »
Hi,

 Ok, I have put together a unity package ( you do need to own PlayMaker for it work). All the logic is done with playmaker, no script or custom actions.


 It does the following:

 1: a "GUI" gameObject is responsible for display 3 buttons, "cube 1", "cube 2" and "cube 3".
 
 2: a "cube" prefab with two global events: "SHOW" and "HIDE". I created three instances in the scene "cube 1", "cube 2" and "cube 3"

when the user click on gui buttons, it dispatch a "SHOW" to the appropriate cube, and broadcast a "HIDE" to all other cubes.

Also the gui is responsible for showing only "cube 1" at start.

 I think this is simple enough for beginners. Personally, I would create the gui differently, cause everything is harcoded for gui and button actions. but that's not the point here.

Now, to extend this to any objects, not just cubes: Them objects only need to implement the "SHOW" and "HIDE" event and they will work. don't forget to modify the GUI to implement the buttons and do the right calls.

If you have problems understanding how this is done, get back to me.

 Bye,

 Jean

shsha

  • Playmaker Newbie
  • *
  • Posts: 8
Re: need help...
« Reply #6 on: January 19, 2012, 03:22:06 AM »
 that`s what i need it`s so helpful to me  ;D

thanx alot .....