holopy3/Assets/Scripts/RingCatcher.cs

18 lines
411 B
C#
Raw Permalink Normal View History

2020-12-10 14:25:12 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RingCatcher : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Ring"))
{
AudioSource source = other.gameObject.GetComponentInParent<AudioSource>();
source.Play();
Destroy(other.gameObject);
}
}
}