holopy3/Assets/Ancient Modular Tombs/Scripts/Destruction.cs

30 lines
572 B
C#
Raw Normal View History

2020-12-10 14:25:12 +00:00
using UnityEngine;
using System.Collections;
public class Destruction : MonoBehaviour {
public Rigidbody[] chunks;
public GameObject dustFX;
public AudioClip audioClip;
// Use this for initialization
void Start () {
}
void OnTriggerEnter(Collider other){
if(other.gameObject.tag == "Player"){
foreach (Rigidbody chunk in chunks){
chunk.useGravity = enabled;
chunk.isKinematic = false;
dustFX.SetActive(true);
GetComponent<AudioSource>().PlayOneShot(audioClip);
}
}
}
// Update is called once per frame
void Update () {
}
}