t1 / TFDContents / Assets / KinectDemos / ColliderDemo / Scripts / JumpTrigger.cs @ 3
이력 | 보기 | 이력해설 | 다운로드 (525 Bytes)
1 |
using UnityEngine; |
---|---|
2 |
using System.Collections; |
3 |
|
4 |
public class JumpTrigger : MonoBehaviour |
5 |
{ |
6 |
void OnTriggerEnter() |
7 |
{ |
8 |
//Debug.Log ("Jump trigger activated"); |
9 |
|
10 |
// start the animation clip |
11 |
Animation animation = gameObject.GetComponent<Animation>(); |
12 |
if(animation != null && !animation.isPlaying) |
13 |
{ |
14 |
animation.Play(); |
15 |
} |
16 |
|
17 |
// play the audio clip |
18 |
AudioSource audioSrc = gameObject.GetComponent<AudioSource>(); |
19 |
if(audioSrc != null && !audioSrc.isPlaying) |
20 |
{ |
21 |
audioSrc.Play(); |
22 |
} |
23 |
} |
24 |
} |