soundvision/UnityProject/Assets/AzureKinectExamples/KinectDemos/ColliderDemo/Scripts/JumpTrigger.cs
max 53c1b2d7b5 Azure Kinect Demos
Bought the asset to test with
2019-10-26 11:04:12 +02:00

29 lines
708 B
C#

using UnityEngine;
using System.Collections;
namespace com.rfilkov.components
{
public class JumpTrigger : MonoBehaviour
{
void OnTriggerEnter()
{
//Debug.Log("Jump trigger entered.");
// start the animation clip
Animation animation = gameObject.GetComponent<Animation>();
if (animation != null && !animation.isPlaying)
{
animation.Play();
}
// play the audio clip
AudioSource audioSrc = gameObject.GetComponent<AudioSource>();
if (audioSrc != null && !audioSrc.isPlaying)
{
audioSrc.Play();
}
}
}
}