Files
SpaceDroid/My project/Assets/Script/Meteorite.cs
2025-01-17 13:10:42 +01:00

25 lines
689 B
C#

using System;
using UnityEngine;
using static UnityEngine.EventSystems.EventTrigger;
public class Meteorite : MonoBehaviour
{
private Rigidbody rigidbodyComponent;
private UIManager UIManager;
void Start()
{
UIManager = FindAnyObjectByType<UIManager>();
rigidbodyComponent = GetComponent<Rigidbody>();
//rigidbodyComponent.linearVelocity = new Vector3(0.7f, -0.4f, 0);
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.layer != 9)
{
if (other.gameObject.tag == "droid")
StartCoroutine(UIManager.GameOverSequence());
Destroy(other.gameObject);
}
}
}