Files
BABA_YAGA/Assets/Scripts/AI NPC/LaserProjectile.cs
2026-06-04 23:01:39 +07:00

36 lines
719 B
C#

using UnityEngine;
using Hallucinate.Audio;
public class LaserProjectile : MonoBehaviour
{
public float speed = 5f;
public float lifeTime = 5f;
[Header("Audio")]
public string hitSound = "Laser_Hit";
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");
AudioManager.Instance?.Play(hitSound, position: transform.position);
Destroy(gameObject);
}
}
}