edx/assignment9final/Assets/Scripts/GrabPickups.cs
2022-11-10 21:56:29 -03:00

22 lines
502 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class GrabPickups : MonoBehaviour {
private AudioSource pickupSoundSource;
void Awake() {
pickupSoundSource = DontDestroy.instance.GetComponents<AudioSource>()[1];
}
void OnControllerColliderHit(ControllerColliderHit hit) {
if (hit.gameObject.tag == "Pickup") {
TrackLevel.current_level++;
pickupSoundSource.Play();
SceneManager.LoadScene("Play");
}
}
}