Arrow.cs 473 B

12345678910111213141516171819202122232425
  1. using System.Collections;
  2. using UnityEngine;
  3. namespace SmartBowSDK {
  4. public class Arrow : MonoBehaviour
  5. {
  6. void Start()
  7. {
  8. StartCoroutine(DestroySelf());
  9. }
  10. void Update()
  11. {
  12. this.transform.position += transform.forward * Time.deltaTime * 10f;
  13. }
  14. IEnumerator DestroySelf()
  15. {
  16. yield return new WaitForSeconds(3f);
  17. Destroy(gameObject);
  18. }
  19. }
  20. }