internal ProjectileViewer(MainWindow mw, string folder) { this.mw = mw; Title = "Projectiles"; vfs = FileSystem.FromFolder(folder); var flini = new FreelancerIni(vfs); var data = new FreelancerData(flini, vfs); effects = new EffectsIni(); equipment = new EquipmentIni(); data.Equipment = equipment; foreach (var path in flini.EffectPaths) { effects.AddIni(path, vfs); } foreach (var path in flini.EquipmentPaths) { equipment.AddEquipmentIni(path, data); } projectileList = equipment.Munitions.Where(x => !string.IsNullOrWhiteSpace(x.ConstEffect)).OrderBy(x => x.Nickname).ToArray(); var fxShapes = new TexturePanels(flini.EffectShapesPath, vfs); foreach (var f in fxShapes.Files) { var path = vfs.Resolve(flini.DataPath + f); mw.Resources.LoadResourceFile(path); } viewport = new Viewport3D(mw); viewport.Background = Color4.Black; viewport.DefaultOffset = viewport.CameraOffset = new Vector3(0, 0, 20); viewport.ModelScale = 10f; viewport.ResetControls(); fxPool = new ParticleEffectPool(mw.Commands); beams = new BeamsBuffer(); }
public override void Initialize() { base.Initialize(); CheckAndSetInstance(); bulletCount = 0; effectPool = GetProperEffectPool(); }
public SystemRenderer(ICamera camera, GameDataManager data, GameResourceManager rescache, Game game) { this.camera = camera; AsteroidFields = new List <AsteroidFieldRenderer>(); Nebulae = new List <NebulaRenderer>(); StarSphereModels = new IDrawable[0]; Polyline = new PolylineRender(commands); FxPool = new ParticleEffectPool(commands); cache = rescache; rstate = rescache.Game.RenderState; this.game = game; gconfig = game.GetService <GameConfig>(); billboards = game.GetService <Billboards>(); resman = game.GetService <ResourceManager>(); nebulae = game.GetService <NebulaVertices>(); dot = (Texture2D)rescache.FindTexture(ResourceManager.WhiteTextureName); DebugRenderer = new PhysicsDebugRenderer(); if (GLExtensions.Features430) { pointLightBuffer = new ShaderStorageBuffer(MAX_POINTS * (16 * sizeof(float))); if (pointLightCull == null) { pointLightCull = new ComputeShader(Resources.LoadString("LibreLancer.Shaders.lightingcull.glcompute")); } } }
public override void Initialize(Player[] players, GameplayMode mode, PlayArea playArea) { base.Initialize(players, mode, playArea); bulletDirectionScale = GetDirectionScaleVector(); SetAppropriateBulletPool(); chargeEffectPool = ParticleEffectPool.GetPool(ParticleEffectPool.EffectType.CHARGE_ENEMY); initialized = true; }
/// <summary> /// Wait for the particles to die. Once they finish playing, place them back in their respective pool. /// </summary> public IEnumerator WaitForParticleDeath(ParticleSystem particleSystem, ParticleEffectPool pool) { // Wait for as long as the particle system lasts yield return(new WaitForSeconds(particleSystem.duration)); // Stop the particle system once it is done playing particleSystem.Stop(); // Place the particle system back into its pool for later re-use. pool.Free(particleSystem); }
/// <summary> /// Plays the given particle effect at the given position. Note that particle effects are denoted by enum constants /// instead of GameObjects /// </summary> public void Play(ParticleEffect particleEffect, Vector3 position) { // Retrieves the pool which stores instances of the desired particle effect ParticleEffectPool pool = particleEffectPools[particleEffect]; // Obtain a particle effect from the pool. This is the particle effect that will be played ParticleSystem particleSystem = pool.Obtain(); // Set the position of the particle system particleSystem.transform.position = position; // Play the particle effects particleSystem.Play(); // Wait for the particles to die and place them back in the pool once they do StartCoroutine(WaitForParticleDeath(particleSystem, pool)); }
ParticleEffectPool GetProperEffectPool() { switch (type) { case BulletPoolType.ENEMY_SLOW: return(ParticleEffectPool.GetPool(ParticleEffectPool.EffectType.BULLETHIT_ENEMY)); case BulletPoolType.ENEMY_NORMAL: return(ParticleEffectPool.GetPool(ParticleEffectPool.EffectType.BULLETHIT_ENEMY)); case BulletPoolType.ENEMY_FAST: return(ParticleEffectPool.GetPool(ParticleEffectPool.EffectType.BULLETHIT_ENEMY)); case BulletPoolType.FRIENDLY_NORMAL: return(ParticleEffectPool.GetPool(ParticleEffectPool.EffectType.BULLETHIT_FRIENDLY)); case BulletPoolType.FRIENDLY_FAST: return(ParticleEffectPool.GetPool(ParticleEffectPool.EffectType.BULLETHIT_FRIENDLY)); default: throw new UnityException("unsupported bullettype \"" + type.ToString() + "\""); } }
void FixedUpdate() { if ((Time.time > explodeTime) && mr.enabled) { mr.enabled = false; coll.enabled = true; // ParticleEffectPool.GetPool(ParticleEffectPool.EffectType.EXPLOSION_AA).NewEffect(transform.position, transform.forward, true, gameObject.layer); ParticleEffectPool.GetPool(ParticleEffectPool.EffectType.EXPLOSION_AA).NewEffect(transform.position, transform.forward, true); } if (coll.enabled) { fixedUpdateTicks++; if (fixedUpdateTicks > fixedUpdateHurtTicks) { gameObject.SetActive(false); } } }
public AleViewer(string title, string name, AleFile ale, MainWindow main) { plib = new ParticleLibrary(main.Resources, ale); pool = new ParticleEffectPool(); effectNames = new string[plib.Effects.Count]; for (int i = 0; i < effectNames.Length; i++) { effectNames[i] = string.Format("{0} (0x{1:X})", plib.Effects[i].Name, plib.Effects[i].CRC); } Title = title; this.name = name; this.rstate = main.RenderState; aleViewport = new Viewport3D(main); aleViewport.DefaultOffset = aleViewport.CameraOffset = new Vector3(0, 0, 200); aleViewport.ModelScale = 25; buffer = main.Commands; billboards = main.Billboards; polyline = main.Polyline; debug = main.DebugRender; SetupRender(0); }
/// <summary> /// Sets the ParticleSystem which will be played when the ParticleEffect enumerator constant is chosen as an effect to play /// </summary> public void SetParticlePrefab(ParticleEffect particleEffect, ParticleSystem prefab) { // Sets the particle effect prefab for the enum constant if (!particleEffectPrefabs.ContainsKey(particleEffect)) { particleEffectPrefabs.Add(particleEffect, prefab); } else { particleEffectPrefabs[particleEffect] = prefab; } // Creates a new pool which will clone the given prefab. The pool is stored inside an internal dictionary. if (!particleEffectPools.ContainsKey(particleEffect)) { particleEffectPools.Add(particleEffect, new ParticleEffectPool(prefab)); } else { particleEffectPools[particleEffect] = new ParticleEffectPool(prefab); } }
void Update() { if (hitpoints <= 0 && coll.enabled) { for (int i = 0; i < explosionPoints.Length; i++) { ParticleEffectPool pool; if (Random.value > 0.5f) { pool = ParticleEffectPool.GetPool(ParticleEffectPool.EffectType.FIREBALL_MEDIUM); Debug.Log("medium"); } else { pool = ParticleEffectPool.GetPool(ParticleEffectPool.EffectType.FIREBALL_SMALL); Debug.Log("small"); } pool.NewEffect(explosionPoints[i].transform.position, Random.insideUnitSphere, gameObject.transform.parent, gameObject.layer); //LayerMask.NameToLayer("Background") } theObject.SetActive(false); coll.enabled = false; } }
protected virtual void DeathAction() { ParticleEffectPool.GetPool(deathEffect).NewEffect(transform.position, transform.forward, true); gameObject.SetActive(false); }
void Start() { fireballPool = ParticleEffectPool.GetPool(ParticleEffectPool.EffectType.FIREBALL_MEDIUM); }