playMaker

Author Topic: Setting a FSM for yet-to-be-created object  (Read 2011 times)

sntran

  • Playmaker Newbie
  • *
  • Posts: 3
Setting a FSM for yet-to-be-created object
« on: July 17, 2013, 11:13:33 PM »
Hi,

I am using PlayMaker for a simple physic-based drawing game, in which
the player draws the shape and creates a game object.

I have a DrawBoard object with an FSM in it to detect mouse inputs, and
start the drawing process using a custom behaviour.

The behaviour then creates a game object programmatically.

I would like to add an FSM to that object so that I could handle interactions
(gestures, drag and throw, etc) on it, but I am not sure how. I don't have
the object in my hierarchy during development, only when the game is
played.

There can be many instances of that object so I don't think I can use global
variable for this purpose. I also don't have control over the creation of the
object, only when it is created, so I can't make a prefab for it either.

Technically, I would like to separate that FSM from the DrawBoard's FSM.

Thanks in advance!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15621
  • Official Playmaker Support
Re: Setting a FSM for yet-to-be-created object
« Reply #1 on: July 28, 2013, 12:22:47 PM »
Hi,

 I do that all the time :) the trick is the following: talk to your yet-to-be-created-go using actions such as "set fsm xxx" and "get fsm xxx" and manually enter the fsm name and variable name, this is very much like the "interface" that you expect for this gameobject.

 also, you can send events to gameobjects references, that works in your case too, if it implements the event it will respond.

 Does that help?

Bye,

Jean