playMaker

Author Topic: Filling up an FSM array with toggles  (Read 1599 times)

ndever

  • Playmaker Newbie
  • *
  • Posts: 13
Filling up an FSM array with toggles
« on: May 07, 2017, 03:44:05 PM »
Hi there,

I'm new to Unity and Playmaker and got stuck big time, hope you guys can help me! :)

So I've been working on a dice rolling game where the player can select different kind of dice and then roll. Simple, right? I'm using an array (bool) where each element stores whether the particular die is selected or not. So I created some toggles and thought that with the help of Playmaker uGUI Component Proxy those toggles can fill up the FSM's array variable.

Unfortunately the UI Callback is "on value changed (bool)" so it needs a bool variable not an array. And this is where I'm lost. Can I do it this way? Or should I take a totally different approach?

Thanks in advance for your answers!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Filling up an FSM array with toggles
« Reply #1 on: May 07, 2017, 04:42:55 PM »
Hi,
you can use the "uGUI Component Proxy" and have a fsm with the Variable
then on that fsm use the action 'bool changed' the set changed event to the next state.
In the next state use 'array set' and set the array index nr
then loop back to the previous state.


ndever

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Filling up an FSM array with toggles
« Reply #2 on: May 07, 2017, 05:54:37 PM »
Thanks for the quick response! I tried what you suggested but something's not right. I use two FSMs, one has all the toggles in it as uGUI Component Proxies. Action: send FSM event, the target is the other FSM and the event is "ugui / on bool value changed". The other FSM receives the signal but nothing's happening.

As this is my first project I'm pretty sure I set up the states or transitions wrong. I've attached a screenshot could you tell me what's off with it?

Thanks!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Filling up an FSM array with toggles
« Reply #3 on: May 08, 2017, 05:25:27 AM »
Hi,
Here is a picture of how you can set it up :


free ssl image hosting

ndever

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Filling up an FSM array with toggles
« Reply #4 on: May 08, 2017, 04:28:14 PM »
Thank you so much! It seems to be working, yay!