playMaker

Author Topic: Chaining Mecanim animations with playmaker  (Read 2404 times)

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
Chaining Mecanim animations with playmaker
« on: January 18, 2014, 04:02:01 AM »
I have a simple scenario where a player could press an attack button multiple times and it would do different combos based upon the button combinations.

So a simple example would be pressing the punch button twice, in this example I would expect the following logical actions to occur:

- Player Presses Punch Button
- Punch_1 Animation Is Played
- Player Presses Punch Button
- Punch_2 Animation Is Played
- Player Does Nothing
- Idle Animation Is Played

Now the problem is that in the above I have a state which is globally triggered when a punch button is pressed from a non attacking state. Then it will do the following FSM actions:

- Animator Play (Punch_1)
- Get Button Down (Punch) > If down raise OnPunchButtonPressed event
- Get Animator Current State Is Name (Punch_1) > If no revert to Idle FSM

Now the problem above is that when it plays the animation it is only starting the animation, not waiting for it to finish. So it begins playing, then checks for the punch button being pressed which never occurs fast enough and I can see in the playmaker window that the moment the FSM switches to the attack logic it almost instantly goes back to idle, so there is never a chance for it to listen for the punch button to go down.

So is there a way to make it wait until the animation is done before progressing to the next state? I was thinking maybe I could make a custom action, but then realised that what if this player was attacked during his attack and you needed to boot the player out of that and put them into a Damaged FSM...

I am new to all this so I apologise if I have overlooked some simple ways to manage the above but I am just a bit confused as to how to correctly chain together attacks and if no subsequent attack occurs while currently attacking go back to the idle state.

Any advice would be great!

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Re: Chaining Mecanim animations with playmaker
« Reply #1 on: January 23, 2014, 06:44:27 PM »
have you tryed to add a wait action before it exit to next state ?