Commit 1
This commit is contained in:
27
Assets/Scripts/VFX/SukunaProjectile.cs
Normal file
27
Assets/Scripts/VFX/SukunaProjectile.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user