Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: weavermount on April 03, 2015, 10:14:41 PM
-
I have FSM that keeps track of the time between mousedown and mouse up, then spawns (via pathological pool manager) a projectile. How to I inform the projectile how long it was charged for (the time between mouse down and mouse up)?
I need to figure out some way to get it that information before it's drawn for the first time. Any best practices? I can think of a lot of akward hacks, but nothing that feels good.
Thanks in advance
-
How about having the "creator" save the new object in an object variable when you spawn it -- and immediately after pass the data to it using Set FSM Variable?
/Bad
-
Turns out I'm just not used to exactly how the two FSMs were timing there states.
I might not be very FSMonic( ... FSM-ly?) but I made an empty "Hold for data" State followed by and "Init" state followed by a "Fly" state. Once I told it to wait for data before using it it cleared up
-
Typically you can spawn and set the data in the same state. For instance using Create Object, storing the reference to the new object and immediately using Set Fsm <type> on that object reference. You could additionally fire an event on that FSM after you've set the data, like a "ready" event that is fired from an empty Start state.
I find that nearly all of my start states are used for initialization. I don't typically require a 'handshake' event like that, but it seems like a good idea.
-
Hi,
yep, I confirm Lane's post. instanciate your prefab, and set fsm variables on it directly, it works.
I usually have a small handshake like an "INIT" global event or something when I need asynchronous process, typically, if the operation involving the creation of the instance has more to do after to get everything setup.
It's also good to send a quick "INIT", because then the instance can get who sent that INIT event ( using get event info action) and talk back very easily (without the need for global variables :) )
Bye,
Jean