holopy3/Assets/Scripts/FallDownTrigger.cs

32 lines
600 B
C#
Raw Normal View History

2020-12-10 14:25:12 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;
public class FallDownTrigger : MonoBehaviour
{
private AudioSource source;
private bool oneShot;
// Update is called once per frame
private void Start()
{
source = GetComponent<AudioSource>();
}
void Update()
{
if (transform.position.y < -10 && !oneShot)
{
source.Play();
oneShot = true;
}
if (transform.position.y < -100)
{
SteamVR_Fade.View(Color.black, 0.3f);
}
}
}