protected override void Awake() { base.Awake(); explosionPool = new Queue <ParticleSystem>(); instance = this; AllocPool(); }
override public void Start() { base.Start(); GameObject explosionPoolGameObject = GameObject.FindWithTag("ExplosionPool"); // WARNING: SLOW!! explosionPool = explosionPoolGameObject.GetComponent <ExplosionPool>(); }
void Awake() { if (!ExplosionPool) { ExplosionPool = FindObjectOfType <ExplosionPool>(); } Teleportable = GetComponent <TeleportableEntity>(); OnAwake(); }
// Start is called before the first frame update void Awake() { if (!PlayerProjectilePool.Initialized) { PlayerProjectilePool.Initialize(); } if (!ExplosionPool.Initialized) { ExplosionPool.Initialize(); } }
protected void SetCommonComponents() { layerMask = (1 << LayerMask.NameToLayer("Enemies")); rigidBody = GetComponent <Rigidbody>(); animator = GetComponentInChildren <Animator>(); audioSources = GetComponents <AudioSource>(); explosionPool = StarterController.Instance.GetExplosionPool(); startParticlesForDamageSmoke = damageSmoke.main.maxParticles; maxParticlesForDamageSmoke = damageSmoke.main.maxParticles * 2; durability *= durability; quaterCheckGround = rayCheckingGroundLength / 4; standUpTime = .2f * (Mathf.Max(scale * .5f, 2f)); }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.TryGetComponent <EnemyAI>(out EnemyAI enemy)) { GameObject explosion = ExplosionPool.GetExplosion(); explosion.transform.position = transform.position; explosion.SetActive(true); explosion.GetComponent <Explosion>().Play(); Destroy(gameObject); } }
private void Update() { if (interaction == null) { return; } Vector3 position = GetPosition(1f - interaction.NormalizedTime); if (position.x == float.NaN) { gameObject.SetActive(false); return; } Quaternion rotation = Quaternion.LookRotation(prevPosition - position) * Quaternion.Euler(90, 0, 0); prevPosition = position; transform.rotation = rotation; transform.position = position; if (interaction.IsEnded) { var destroyVector = Vector3.zero; if (interaction.NormalizedTime > 0) { var extrapolatedPosition = GetPosition((1f - interaction.NormalizedTime) + 0.01f / interaction.FlyTime); destroyVector = (extrapolatedPosition - position) * 100f * destroySpeed; } const float explodeRadius = 0.15f; ExplosionPool.Explode(position, destroyVector, explodeRadius); interaction = null; Timer.Add(explosionDelay, (anim) => { if (this == null) { return; } transform.position = transform.position + destroyVector * Time.deltaTime; }, () => { if (this == null) { return; } Timer.Add(destroyDelay, () => { if (this == null) { return; } gameObject.SetActive(false); }); }); } }
void Awake() { m_ExplosionPoolInstance = ExplosionPool.Instance; if (m_ExplosionPoolInstance == null) { Debug.LogError("m_ExplosionPoolInstance == null"); } m_ExplosionPoolInstance.Init(m_ExplosionPrefabPath); // m_ExplosionListArray = new LinkedList<GameObject>[(int)PathGrid.eNeighborDirection.kNumNeighbors]; // InitExplosionListArray(); m_ExplosionList = new List <GameObject>(); }
public void ReturnToThePool() { ExplosionPool.ReturnExplosion(gameObject); }
private void Awake() { weaponsPool = new WeaponsPool(new Weapon(Weapon.Type.Torpedo, Weapon.Status.Disarmed), 3); explosionPool = new ExplosionPool(new Explosion(Explosion.Type.Large), 3); }
public ExplosionView prototype; // Set from editor private void Awake() { instance = this; }
private void Awake() { TorpedoTestHarness.torpedoPool = new WeaponsPool(new Weapon(Weapon.Type.Torpedo, Weapon.Status.Disarmed), 3); TorpedoTestHarness.explosionPool = new ExplosionPool(new Explosion(Explosion.Type.Large), 3); }
public static void PurgeInstance() { _instance = null; }