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