You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.1 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
public class Trap : MonoBehaviour
{
public GameObject bridge;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnCollisionEnter(Collision collision)
{
Debug.Log("Enter");
}
private void OnCollisionStay(Collision collision)
{
collision.transform.GetComponent<Player>().health -= 1f;
//Debug.Log(collision.transform.GetComponent<Player>().health);
}
private void OnCollisionExit(Collision collision)
{
Debug.Log("Exit");
}
private void OnTriggerEnter(Collider other)
{
GameObject tv = GameObject.Find("TV");
tv.GetComponent<VideoPlayer>().Play();
}
private void OnTriggerStay(Collider other)
{
}
private void OnTriggerExit(Collider other)
{
GameObject tv = GameObject.Find("TV");
tv.GetComponent<VideoPlayer>().Pause();
}
}