// *********************************************************************** // Assembly : Game // Author : Kimch // Created : 2020-09-02 // Description : // Last Modified By : // Last Modified On : // *********************************************************************** // // // *********************************************************************** using UnityEngine; namespace G { /// /// /// public class Poisonball : MonoBehaviour { private float _shootDelay; private Vector3 _shootDir; private bool _explode; private ParticleSystem _particle; private Transform _boom; private void Awake() { _particle = GetComponent(); } private void Start() { _shootDir = transform.parent.forward - Vector3.up * 0.5f; _boom = GameObject.FindWithTag("skill").transform; transform.parent = null; } private void ColliderOff() { this.GetComponent().enabled = false; } private void Update() { if (_explode) { return; } if (_shootDelay > 1f) { Vector3 position = transform.position; position += _shootDir * (Time.deltaTime * 2.5f); transform.position = position; if (position.y <= 0f) { this.GetComponent().enabled = true; Invoke(nameof(ColliderOff), 0.4f); _explode = true; //_particle.rndVelocity = Vector3.one; _boom.GetComponent().SetTex(2, position, true); Destroy(this.gameObject, 1.2f); } } else { _shootDelay += Time.deltaTime; } } } }