| | 1 | | using System.Collections; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using UnityEngine; |
| | 4 | |
|
| | 5 | | public class AvatarAnimationEventAudioHandler : MonoBehaviour |
| | 6 | | { |
| | 7 | | AudioEvent footstepLight; |
| | 8 | | AudioEvent footstepSlide; |
| | 9 | | AudioEvent footstepWalk; |
| | 10 | | AudioEvent footstepRun; |
| | 11 | | AudioEvent footstepJump; |
| | 12 | | AudioEvent footstepLand; |
| | 13 | | AudioEvent clothesRustleShort; |
| | 14 | | AudioEvent clap; |
| | 15 | | AudioEvent throwMoney; |
| | 16 | | AudioEvent blowKiss; |
| | 17 | |
|
| | 18 | | public void Init(AudioContainer audioContainer) |
| | 19 | | { |
| 0 | 20 | | if (audioContainer == null) |
| 0 | 21 | | return; |
| | 22 | |
|
| 0 | 23 | | footstepLight = audioContainer.GetEvent("FootstepLight"); |
| 0 | 24 | | footstepSlide = audioContainer.GetEvent("FootstepSlide"); |
| 0 | 25 | | footstepWalk = audioContainer.GetEvent("FootstepWalk"); |
| 0 | 26 | | footstepRun = audioContainer.GetEvent("FootstepRun"); |
| 0 | 27 | | footstepJump = audioContainer.GetEvent("FootstepJump"); |
| 0 | 28 | | footstepLand = audioContainer.GetEvent("FootstepLand"); |
| 0 | 29 | | clothesRustleShort = audioContainer.GetEvent("ClothesRustleShort"); |
| 0 | 30 | | clap = audioContainer.GetEvent("ExpressionClap"); |
| 0 | 31 | | throwMoney = audioContainer.GetEvent("ExpressionThrowMoney"); |
| 0 | 32 | | blowKiss = audioContainer.GetEvent("ExpressionBlowKiss"); |
| 0 | 33 | | } |
| | 34 | |
|
| 0 | 35 | | public void AnimEvent_FootstepLight() { TryPlayingEvent(footstepLight); } |
| | 36 | |
|
| 0 | 37 | | public void AnimEvent_FootstepSlide() { TryPlayingEvent(footstepSlide); } |
| | 38 | |
|
| 0 | 39 | | public void AnimEvent_FootstepWalk() { TryPlayingEvent(footstepWalk); } |
| | 40 | |
|
| 0 | 41 | | public void AnimEvent_FootstepRun() { TryPlayingEvent(footstepRun); } |
| | 42 | |
|
| 0 | 43 | | public void AnimEvent_FootstepJump() { TryPlayingEvent(footstepJump); } |
| | 44 | |
|
| 0 | 45 | | public void AnimEvent_FootstepLand() { TryPlayingEvent(footstepLand); } |
| | 46 | |
|
| 0 | 47 | | public void AnimEvent_ClothesRustleShort() { TryPlayingEvent(clothesRustleShort); } |
| | 48 | |
|
| 0 | 49 | | public void AnimEvent_Clap() { TryPlayingEvent(clap); } |
| | 50 | |
|
| 0 | 51 | | public void AnimEvent_ThrowMoney() { TryPlayingEvent(throwMoney); } |
| | 52 | |
|
| 0 | 53 | | public void AnimEvent_BlowKiss() { TryPlayingEvent(blowKiss); } |
| | 54 | |
|
| | 55 | | void TryPlayingEvent(AudioEvent audioEvent) |
| | 56 | | { |
| 0 | 57 | | if (audioEvent != null) |
| 0 | 58 | | audioEvent.Play(true); |
| 0 | 59 | | } |
| | 60 | | } |