VR/Assets/Suicide.cs

32 lines
853 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Suicide : MonoBehaviour
{
// This method is called when a collision occurs
public float fadeDuration = 2.0f; // Duration of the fade in seconds
public Material skybox;
public Light sun;
private void OnCollisionEnter(Collision collision)
{
// Check if the collision is with the specific object you want
if (collision.gameObject.CompareTag("Bullet"))
{
MarcsWebLogger.Log("SC | Shoot Collision");
// Your collision handling code goes here
//transform.Translate(Vector3.up * 2);
sun.enabled = false;
skybox.SetColor("_Tint", Color.black);
MarcsWebLogger.Log("SC | Cooroutine shoudlb be running");
}
}
}