public static void UnSubscribePool(PoolOfPools poolToUnSubscribe) { pools.Remove(poolToUnSubscribe); if (pools.Count.Equals(0)) { pools.Clear(); } }
/// <summary> /// Fire the weapon. Pools a bullet and the plays the sound and weapon vfx. /// </summary> public void FireWeapon() { if (canShoot) { Poolable bullet = PoolOfPools.GetObjectFromPool(bulletToFire); bullet.transform.position = bulletSpawnPoint.position; bullet.transform.rotation = bulletSpawnPoint.rotation; bullet.PoolExited(); soundsComponent.PlayShootSound(); effectsComponent.PlayParticleEffect(); canShoot = false; } }
public static void SubscribePool(PoolOfPools poolToSubscribe) { pools.Add(poolToSubscribe); }