Files
BABA_YAGA/Assets/Scripts/VFX/SukunaProjectile.cs

28 lines
661 B
C#
Raw Permalink Normal View History

2026-03-26 20:27:19 +07:00
using UnityEngine;
public class SukunaProjectile : MonoBehaviour
{
[Header("Movement")]
public float speed = 50f;
public float lifetime = 3f;
private Vector3 moveDirection;
public void SetDirection(Vector3 direction)
{
// Nhận hướng bay từ Player (luôn là hướng phía trước)
moveDirection = direction.normalized;
}
void Start()
{
Destroy(gameObject, lifetime);
}
void Update()
{
// Di chuyển đạn theo hướng đã gán, bất kể góc xoay hiển thị của nó là gì
transform.position += moveDirection * speed * Time.deltaTime;
}
}