Advertisement
kadyr

Untitled

Nov 21st, 2021
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class ZeusScript : Enemy
  6. {
  7. // Start is called before the first frame update
  8. public GameObject lighting;
  9. public GameObject _lightingRing;
  10. public float coolDown = 2f;
  11. private float timer = 0;
  12. public Animator animator;
  13. private bool isUsingAbility;
  14. private GameObject player;
  15. void Start()
  16. {
  17. base.Start();
  18. player = GameObject.FindObjectOfType<PlayerController>();
  19. }
  20. private IEnumerator useAbility()
  21. {
  22. useAbility = true;
  23. yield return new WaitForSeconds(11f);
  24. LightingRing();
  25. }
  26. public void LightingRing
  27. {
  28. Instantiate(_lightingRing, transform.position, Quaternion.identity);
  29. // animator.SetTrigger("LightingRing");
  30. }
  31. protected override void Attack()
  32. {
  33. timer += Time.deltaTime;
  34. if(Vector3.Distance(transform.position, player.transform.position)<50f)
  35. {
  36. if(timer>coolDown)
  37. {
  38. timer = 0;
  39. var _lighting = Instantiate(lighting, transform.position,transform.rotation);
  40. _lighting.GetComponent<LightingBullet>.SetDirection(transform.forward);
  41. animator.SetTrigger("AttackAnimation");
  42. }
  43. }
  44.  
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement