playMaker

Author Topic: Merger Node  (Read 5352 times)

Lars Steenhoff

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 46
Merger Node
« on: March 31, 2011, 04:36:59 PM »
I'm not sure if its already there, let me explain what I mean.

Let's say I got an action to rotate a pinball flipper.
At the moment this action runs I let it play a sound.

This is is working fine, now let's say I have two flippers activated a the same time ( left and right) now the sound would play twice at the same, still not too bad for performance.
Now comes the thing I'm looking for,  what if I wanted to activate 4 left flippers at the same time?  the sound would play 4 times at the same time.
This would sure be bad for performance.

What I would like to achieve, is to have 4 flippers rotate a the same time but only play the sound once. 
Is there a way to do this ?





Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Merger Node
« Reply #1 on: March 31, 2011, 09:49:17 PM »
Haven't tested this, but using Audio Play instead of Play Sound might do what you want, since the AudioSource can (I believe) only play one audio clip at a time. Each Play would probably restart the clip though, which might not sound so good... you'd have to try it...

You could also have an AudioManagerFSM that waits for audio events. Your bumpers would send audio events to this FSM. After the AudioManagerFSM gets an event and plays a sound you could Wait for some small timeout period before returning to the Idle state.

There may be a better/built-in way to do this in Unity... haven't played with audio much yet...

If not, I can look into adding a maxCount option to Play Sound. I imagine you'd want to track this by audioclip?