// *********************************************************************** // Assembly : Game // Author : Kimch // Created : 2020-09-02 // Description : // Last Modified By : // Last Modified On : // *********************************************************************** // // // *********************************************************************** using UnityEngine; namespace G { /// /// /// public class BulletPet4 : MonoBehaviour { private const int MAX_BULLET = 6; private Transform[] _spear = new Transform[MAX_BULLET]; private ParticleSystem _splashFx; private int _curFire; private ParticleSystem[] _feathres = new ParticleSystem[MAX_BULLET]; private void Awake() { int dx = 1; for (int i = 0; i < MAX_BULLET; i++) { _spear[i] = transform.GetChild(i); _spear[i].GetComponent().Init(this, dx); dx *= -1; } _splashFx = transform.GetChild(6).GetComponent(); for (int i = 0; i < MAX_BULLET; i++) { _feathres[i] = transform.GetChild(7).GetChild(i).GetComponent(); } this.gameObject.SetActive(false); } private void OnEnable() { _curFire = 0; InvokeRepeating(nameof(FireOn), 0.1f, 0.2f); } public void SplashOn(Vector3 _pos) { _pos.y = 0.05f; _splashFx.transform.position = _pos; _splashFx.Play(); _feathres[_curFire].transform.position = _pos; _feathres[_curFire].Play(); } private void FireOn() { _spear[_curFire].position = transform.position; _spear[_curFire].gameObject.SetActive(true); _curFire++; if (_curFire >= 6) { CancelInvoke(); EntityPet.Instance.AttackFinish(); _curFire = 5; Invoke(nameof(CloseThis), 1f); } } private void CloseThis() { this.gameObject.SetActive(false); } } }