private void CreateMovingParticleEmmitor(Vector position, Vector direction, float speed, float time) { ParticleEmmitor e = new ParticleEmmitor(null, IdMgr.GetNewId(0)); e.Direction = direction; e.EmmitingDirection = direction.Rotate(180); e.MinAngle = (float)(-Math.PI); e.MaxAngle = (float)(Math.PI); e.MinForce = 1; e.MaxForce = 2; e.MinLife = 2f; e.MaxLife = 2.5f; e.Position = position; e.MinSize = 0.2f; e.MaxSize = 1; e.Amount = 250; e.SizeMultiplier = 0; e.Infinite = true; e.Enabled = false; ParticleSphereFactory f = new ParticleSphereFactory(); f.Color = Color.FromArgb(125, 255, 20, 0); e.Factory = f; LinearMovementControl c = new LinearMovementControl(); c.Speed = speed; e.AddControl(c); GameLevelManager.SendNewObject(mgr, e); }
private void CreateExplodingParticleEmmitor(Vector position) { ParticleEmmitor e = new ParticleEmmitor(null, IdMgr.GetNewId(0)); e.EmitingTime = 1f; e.EmmitingDirection = new Vector(1, 0); e.MinAngle = (float)-Math.PI; e.MaxAngle = (float)Math.PI; e.MinForce = 10; e.MaxForce = 15; e.MinLife = 3f; e.MaxLife = 3.5f; e.Position = position; e.MinSize = 0.2f; e.MaxSize = 0.8f; e.Amount = 100; e.SizeMultiplier = 0; e.Infinite = false; e.FireAll = true; e.Enabled = true; byte r = (byte)rand.Next(0, 255); byte g = (byte)rand.Next(0, 255); byte b = (byte)rand.Next(0, 255); ParticleSphereFactory f = new ParticleSphereFactory(); f.Color = colors[rand.Next(colors.Count())]; e.Factory = f; GameLevelManager.SendNewObject(mgr, e); }
public static IParticleFactory ReadParticleFactory(this NetIncomingMessage msg) { IParticleFactory f = null; int hash = msg.ReadInt32(); if (hash == typeof(ParticleSphereFactory).GUID.GetHashCode()) { f = new ParticleSphereFactory(); } else if (hash == typeof(ParticleImageFactory).GUID.GetHashCode()) { f = new ParticleImageFactory(); } else if (hash == typeof(ParticleSmokeFactory).GUID.GetHashCode()) { f = new ParticleSmokeFactory(); } else if (hash == typeof(BaseParticleFactory).GUID.GetHashCode()) { f = new BaseParticleFactory(); } else { Logger.Error("Reading unsupported factory! Hash " + hash); } Logger.Warn("Reading particle factory (" + f.GetType().Name + ") hash " + hash); f.ReadObject(msg); return(f); }
private void CreateConstantParticleEmmitor(Vector position) { ParticleEmmitor e = createConstantEmmitor(position); ParticleSphereFactory f = new ParticleSphereFactory(); f.Color = Color.FromArgb(20, 0, 0, 0); e.Factory = f; GameLevelManager.SendNewObject(mgr, e); }
public static ParticleEmmitor CreateBasicSphere(SceneMgr mgr, Color color) { ParticleEmmitor e = new ParticleEmmitor(mgr, IdMgr.GetNewId(0)); ParticleSphereFactory f = new ParticleSphereFactory(); f.Color = color; e.Factory = f; return(e); }