Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Ioncloud on May 27, 2016, 05:46:11 PM

Title: Getting a state's event and source?
Post by: Ioncloud on May 27, 2016, 05:46:11 PM
I'm trying to figure out if there is a way to get both the source as well as the event that triggered a state?

I'm trying to set up a custom action that can trigger 1...n "sub states" that are denoted by the event that triggers the substate. The child state needs information about the parent state as well as which event was triggered to get there.

I can get the "source" with State.Fsm.PreviousActiveState.ActiveActions but not which event was fired.

What I'm trying to accomplish is something like a level builder, each state has variables for prefabs to make up the walls, floor, and ceiling. When the state is entered, the prefabs are put together and placed in the world. I then have events for "North", "South", "East", "West" that correspond to adjacent tiles. Once the state has built it's object it calls each of the directional states in order to kick off building the next tiles; however, I need to know where the "previous" node was placed as well as what direction the current tile is from the previous in order to offset the next tile appropriately.

Title: Re: Getting a state's event and source?
Post by: mdotstrange on May 27, 2016, 07:45:02 PM
Did you look at the code from the Get Event Info and get event properties actions? They probably have the code you need in them-