| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using Sirenix.OdinInspector;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class PolliwogShot : SpecialSkills
- {
- [Header("òòò½Ô¤ÖÆÌå")]
- public GameObject fishPrefab;
- public int num;
- public Transform pos;
- private bool isAttack;
- private SpineEvent se;
- [HideInInspector]
- public List<Polliwog> pollis;
- //public override void Attack()
- //{
- // se = owner.GetComponent<Enemy>().spineEvent;
- // isAttack = true;
- //}
- private void shoot()
- {
- for (int i = 0; i < num; i++)
- {
- if (PolliwogManager.GetInstance().IsFull()) break;
- PoolManager.InstantiateAsync("Prefab/Enemy/Enemy_Polliwog", pos.position, new Quaternion(0, 0, 0, 0), null, obj =>
- {
- Polliwog pol = obj.GetComponent<Polliwog>();
- });
- }
- }
- public void Shoot(int numm, Vector3 poss)
- {
- pollis = new List<Polliwog>();
- for (int i = 0; i < numm; i++)
- {
- if (PolliwogManager.GetInstance().IsFull()) break;
- PoolManager.InstantiateAsync("Prefab/Enemy/Enemy_Polliwog", poss + new Vector3(Random.Range(-3,3), Random.Range(-3, 3), 0), new Quaternion(0, 0, 0, 0), null, obj =>
- {
- Polliwog pol = obj.GetComponent<Polliwog>();
- pollis.Add(pol);
- pol.rushDir = (pol.transform.position - poss).normalized;
- });
- }
- }
- public void AllPoliDie()
- {
- for (int i = pollis.Count - 1; i >= 0; i--)
- {
- Polliwog pol = pollis[i];
- if (pol.isDie)
- {
- pollis.RemoveAt(i);
- }
- else
- {
- pol.StartReturn(owner.transform);
- }
- }
- }
- private void Update()
- {
- if (isAttack)
- {
- if (se && se.isAttackOn)
- {
- shoot();
- se.isAttackOn = false;
- isAttack = false;
- }
- }
- }
- private void OnTriggerEnter(Collider other)
- {
-
- }
- }
|