Advertisement
kadyr

Untitled

Nov 21st, 2021
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 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.  
  21. private IEnumerator useAbility()
  22. {
  23. while(true)
  24. {
  25. isUsingAbility = true;
  26. yield return new WaitForSeconds(11f);
  27. LightingRingAb();
  28. }
  29.  
  30. }
  31.  
  32. public void LightingRingAb()
  33. {
  34. Instantiate(_lightingRing, transform.position, Quaternion.identity);
  35. // animator.SetTrigger("LightingRing");
  36. }
  37. protected override void Attack()
  38. {
  39. timer += Time.deltaTime;
  40. if(Vector3.Distance(transform.position, player.transform.position)<50f)
  41. {
  42. if(timer>coolDown)
  43. {
  44. timer = 0;
  45. var _lighting = Instantiate(lighting, transform.position,transform.rotation);
  46. _lighting.GetComponent<LightingBullet>.SetDirection(transform.forward);
  47. animator.SetTrigger("AttackAnimation");
  48. }
  49. }
  50.  
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement