Advertisement
kadyr

Untitled

Nov 21st, 2021
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class LightingBullet : MonoBehaviour
  4. {
  5.  
  6. void Update()
  7. {
  8. transform.position += direction * speed * Time.deltaTime; //���������� ���� �� ����������� �� ������
  9. timer += Time.deltaTime;
  10. if(timer>lifeTime)
  11. Destroy(this.gameObject);
  12. }
  13. public void setDirection(Vector3 dir)
  14. {
  15. direction = dir;
  16. }
  17.  
  18. private void OnTriggerEnter(Collider other)
  19. {
  20. if (other.CompareTag("Player"))
  21. {
  22. Debug.Log("collided");
  23. FindObjectOfType<PlayerController>().Damage(-damage);
  24. }
  25. }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement