발사
발사라던가 제작했습니다만 .. 데미지 구현은 모르겠고 큐 효율성을 높여주세요
This commit is contained in:
@@ -4,20 +4,23 @@ using UnityEngine;
|
||||
public class BulletMovement : MonoBehaviour
|
||||
{
|
||||
public float moveSpeed = 10;
|
||||
public float lifeTime = 2;
|
||||
private float _currentTime = 0;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
private void OnEnable()
|
||||
{
|
||||
|
||||
_currentTime = lifeTime;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.Translate(Vector2.up * (Time.deltaTime * moveSpeed));
|
||||
_currentTime -= Time.deltaTime;
|
||||
if (_currentTime <= 0)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user