PolliwogShot.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Sirenix.OdinInspector;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class PolliwogShot : SpecialSkills
  6. {
  7. [Header("òòò½Ô¤ÖÆÌå")]
  8. public GameObject fishPrefab;
  9. public int num;
  10. public Transform pos;
  11. private bool isAttack;
  12. private SpineEvent se;
  13. public override void Attack()
  14. {
  15. se = owner.GetComponent<Enemy>().spineEvent;
  16. isAttack = true;
  17. }
  18. private void shoot()
  19. {
  20. for (int i = 0; i < num; i++)
  21. {
  22. if (PolliwogManager.GetInstance().IsFull()) continue;
  23. PoolManager.InstantiateAsync("Prefab/Enemy/Enemy_Polliwog", pos.position, new Quaternion(0, 0, 0, 0), null, obj =>
  24. {
  25. Polliwog pol = obj.GetComponent<Polliwog>();
  26. });
  27. }
  28. }
  29. private void Update()
  30. {
  31. if (isAttack)
  32. {
  33. if (se && se.isAttackOn)
  34. {
  35. shoot();
  36. se.isAttackOn = false;
  37. isAttack = false;
  38. }
  39. }
  40. }
  41. }