playMaker

Author Topic: Compound Float Compare Help  (Read 1155 times)

cmonroy

  • Playmaker Newbie
  • *
  • Posts: 34
    • View Profile
Compound Float Compare Help
« on: May 06, 2015, 02:19:16 AM »
Hello.

I'm trying to implement a "Season" FSM in which a float value in the range 0, 359 is used to determine the current season (0-89 is Spring, 90-179 is Summer, 180-269 is Autumn and 270-359 is Winter).

Another FSM calculates the float value and send it here via Set FSM Float Value. The value is received correctly but yet it does not get evaluated.

In C#, the code is rather simple:

if(fVal >= 0f && fVal < 90) Debug.Log("It's Spring!");
if(fVal >= 90 && fVal < 180) Debug.Log("It's Summer!");
if(fVal >= 180 && fVal < 270) Debug.Log("It's Autumn!");
if(fVal >= 270 && fVal < 360) Debug.Log("It's Winter!);

Any ideas on how to implement this as an FSM?

Thank you.

Harvid

  • Playmaker Newbie
  • *
  • Posts: 23
    • View Profile
Re: Compound Float Compare Help
« Reply #1 on: May 06, 2015, 02:30:14 PM »
Another FSM calculates the float -- market to a global variabel
Float Compare  -- add the global variabel in Float 1 in the Float Compare

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14483
  • Official Playmaker Support
    • View Profile
Re: Compound Float Compare Help
« Reply #2 on: May 12, 2015, 12:31:54 AM »
Hi,

 I think you can achieve this with one fsm. everytime the value is changed, you compare and set a FsmString "Season" to the right value, and everytime ou detect a season change, you fire a global event "NEW SEASON" and pass in the event data the season string,

Bye,

 Jean