public void Explode() { if (this.gameObject.layer != LayerMask.NameToLayer("Background")) { fireballPool.NewEffect(transform.position, transform.forward, true); TransferToBackground(); } else { fireballPool.NewEffect(transform.position, transform.forward, false); } fireParticleSystem.Stop(true); playerModel.Hide(); hitbox.enabled = false; running = false; exploded = true; }
void OnCollisionEnter(Collision collision) { IDamageable damageable = collision.gameObject.GetComponent <IDamageable>(); if (damageable != null) { damageable.WeaponDamage(damage); } // effectPool.NewEffect(transform.position, Vector3.forward, true, gameObject.layer); effectPool.NewEffect(transform.position, Vector3.forward, collision.gameObject.transform.parent, gameObject.layer); pool.ReturnToInactivePool(this.rb); }
IEnumerator ChargeAndShoot(float chargeTime) { PooledParticleEffect[] chargeEffects = new PooledParticleEffect[bulletOrigins.Length]; for (int i = 0; i < bulletOrigins.Length; i++) { chargeEffects[i] = chargeEffectPool.NewEffect(); chargeEffects[i].gameObject.layer = LayerMask.NameToLayer("Default"); chargeEffects[i].transform.parent = bulletOrigins[i].transform; chargeEffects[i].transform.localPosition = Vector3.zero; chargeEffects[i].transform.localRotation = Quaternion.identity; } yield return(new WaitForSeconds(chargeTime)); for (int i = 0; i < chargeEffects.Length; i++) { chargeEffects[i].Deactivate(true); } ActuallyShoot(); }