25 lines
478 B
C#
25 lines
478 B
C#
using UnityEngine;
|
|
|
|
public class Bullet : MonoBehaviour
|
|
{
|
|
public float Speed = 0.5f;
|
|
float timer;
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
transform.Translate(new Vector3(0,Speed,0));
|
|
|
|
timer += Time.deltaTime;
|
|
if(timer > 2)
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|