FlyLogic.cs 487 B

123456789101112131415161718192021222324
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class FlyLogic : MonoBehaviour
  5. {
  6. public float speed = 10;
  7. // Start is called before the first frame update
  8. void Start()
  9. {
  10. this.Invoke("BulletDestroy", 5);
  11. }
  12. // Update is called once per frame
  13. void Update()
  14. {
  15. this.transform.Translate(0, 0, Time.deltaTime * speed);
  16. }
  17. void BulletDestroy()
  18. {
  19. Object.Destroy(this.gameObject);
  20. }
  21. }