Files
BABA_YAGA/Assets/Scripts/AI NPC/LaserProjectile.cs
2026-06-03 13:42:09 +07:00

30 lines
547 B
C#

using UnityEngine;
public class LaserProjectile : MonoBehaviour
{
public float speed = 5f;
public float lifeTime = 5f;
private void Start()
{
Destroy(gameObject, lifeTime);
}
private void Update()
{
transform.position +=
transform.forward *
speed *
Time.deltaTime;
}
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
Debug.Log("Player Hit");
Destroy(gameObject);
}
}
}