internal void DrawOnShiftInterface(ShiftInterface shiftInterface) { Particles.ForEach(p => shiftInterface.drawOnOverlay(p)); Projectiles.ForEach(p => shiftInterface.drawOnOverlay(p)); Collectables.ForEach(c => shiftInterface.drawOnOverlay(c)); Enemies.ForEach(e => shiftInterface.drawOnOverlay(e)); shiftInterface.drawOnOverlay(MainPlayer); }
internal void DrawMinimap(Camera camera) { Map.DrawMap(camera); Particles.ForEach(p => camera.DrawMinimap(p)); Projectiles.ForEach(p => camera.DrawMinimap(p)); Collectables.ForEach(c => camera.DrawMinimap(c)); Enemies.ForEach(e => camera.DrawMinimap(e)); camera.DrawMinimap(MainPlayer); }
internal void DrawObjects(Camera camera) { Map.DrawTiles(camera); Particles.ForEach(p => camera.Draw(p)); Projectiles.ForEach(p => camera.Draw(p)); Collectables.ForEach(c => camera.Draw(c)); Enemies.ForEach(e => camera.Draw(e)); camera.Draw(MainPlayer); }
/// <summary> /// Saves the file to the specified stream. /// </summary> /// <param name="stream">The stream to save to.</param> public override void Save(Stream stream) { BinaryWriter writer = new BinaryWriter(stream, CodePagesEncodingProvider.Instance.GetEncoding("EUC-KR")); writer.WriteIntString(Name); writer.Write(SoundEnabled ? 1 : 0); writer.WriteIntString(SoundFilePath); writer.Write(LoopCount); writer.Write(Particles.Count); Particles.ForEach(particle => { writer.WriteIntString(particle.Name); writer.WriteIntString(particle.UniqueIdentifier); writer.Write(particle.ParticleIndex); writer.WriteIntString(particle.FilePath); writer.Write(particle.AnimationEnabled ? 1 : 0); writer.WriteIntString(particle.AnimationName); writer.Write(particle.AnimationLoopCount); writer.Write(particle.AnimationIndex); writer.Write(particle.Position); writer.Write(particle.Rotation); writer.Write(particle.Delay); writer.Write(particle.LinkedToRoot ? 1 : 0); }); writer.Write(Animations.Count); Animations.ForEach(animation => { writer.WriteIntString(animation.EffectName); writer.WriteIntString(animation.MeshName); writer.Write(animation.MeshIndex); writer.WriteIntString(animation.MeshFilePath); writer.WriteIntString(animation.AnimationFilePath); writer.WriteIntString(animation.TextureFilePath); writer.Write(animation.AlphaEnabled ? 1 : 0); writer.Write(animation.TwoSidedEnabled ? 1 : 0); writer.Write(animation.AlphaTestEnabled ? 1 : 0); writer.Write(animation.DepthTestEnabled ? 1 : 0); writer.Write(animation.DepthWriteEnabled ? 1 : 0); writer.Write(animation.SourceBlend); writer.Write(animation.DestinationBlend); writer.Write(animation.BlendOperation); writer.Write(animation.AnimationEnabled ? 1 : 0); writer.WriteIntString(animation.AnimationName); writer.Write(animation.AnimationLoopCount); writer.Write(animation.AnimationIndex); writer.Write(animation.Position); writer.Write(animation.Rotation); writer.Write(animation.Delay); writer.Write(animation.LoopCount); writer.Write(animation.LinkedToRoot ? 1 : 0); }); }
internal void Update(float deltaTime) { //Update the FarseerPhysics physics PhysicsWorld.Step(deltaTime); Projectiles.ForEach(p => p.Update(deltaTime)); Particles.ForEach(p => p.Update(deltaTime)); Collectables.ForEach(c => c.Update(deltaTime)); Enemies.ForEach(e => e.Update(deltaTime)); MainPlayer.Update(deltaTime); Map.Update(deltaTime); EnemyDirector.Update(deltaTime); MainCamera.Update(deltaTime); Cull(Projectiles); Cull(Particles); Cull(Collectables); Cull(Enemies); }
internal void ClearGame() { Projectiles.ForEach(p => p.WasCleared()); Projectiles.Clear(); Particles.ForEach(p => p.WasCleared()); Particles.Clear(); Collectables.ForEach(c => c.WasCleared()); Collectables.Clear(); Enemies.ForEach(e => e.WasCleared()); Enemies.Clear(); Map.ClearGame(); EnemyDirector.ClearGame(); MainPlayer.WasCleared(); MainPlayer = null; MainCamera = null; }
public virtual void Predict(double effectiveCountMinRatio, TimeSpan time) { NextEpoch(effectiveCountMinRatio); Particles.ForEach(p => p.DiffuseNormal2D(VelocityNoise, OrientationNoise, time.Ticks)); }
public virtual void Predict(double effectiveCountMinRatio) { NextEpoch(effectiveCountMinRatio); Particles.ForEach(p => p.DiffuseUniform(StdDev)); }
public OneDemExample(double dx_gr = 0d) : base() { dx_granica = dx_gr; int n_pm = perc * scaler; var dx1 = boardL / n_pm; for (int i = 0; i < n_pm; i++) { Particles.Add(new Particle() { Name = i.ToString(), X = -boardL + i * dx1, Ro = 1, P = 1, E = 2.5, V = 0 }); } var dx2 = boardL / (Np - n_pm); for (int i = n_pm; i < Np; i++) { Particles.Add(new Particle() { Name = i.ToString(), X = (i - n_pm) * dx2 + dx_granica, Ro = 0.25, P = 0.1795, E = 1.795, V = 0 }); } for (int i = -1; i > -Np_wall - 1; i--) { Wall.Add(new Particle() { Name = (i).ToString(), X = -boardL + (i) * dx1, Ro = 1, P = 1, E = 2.5, V = 0, IsWall = true }); } for (int i = Np + 1; i <= Np + Np_wall; i++) { Wall.Add(new Particle() { Name = (i).ToString(), X = (i - n_pm - 1) * dx2 + dx_granica, Ro = 0.25, P = 0.1795, E = 1.795, V = 0, IsWall = true }); } var all = Particles.Concat(Wall).OrderBy(p => p.X); AllParticles.AddRange(all); AllParticles.ForEach(p => p.M = 0.6 / n_pm); for (int i = 0; i < AllParticles.Count; i++) { AllParticles[i].MInd = i; } var xs = AllParticles.Select(p => p.X).ToArray(); var walls = AllParticles.Select(p => p.IsWall).ToArray(); SynchMeBefore += SynchMeAfterAct; foreach (var p in Particles) { AddChild(p); } Particles.ForEach(p => p.SetDts()); var mhi = Particles.Where(p => p.P > 0.3).Sum(p => p.M); var mlo = Particles.Where(p => p.P < 0.3).Sum(p => p.M); var mall = Particles.Sum(p => p.M); foreach (var part in AllParticles) { part.Ro = AllParticles.Sum(p => p.M * KernelF.W(part.X - p.X, h)); } foreach (var p in Particles) { p.P = GetP(p); } SynchMeAfter += SynchMeAfterAct; //SynchMeForNext += t => { // foreach(var p in Particles) { // p.P = GetP(p); // } //}; particles_par = Particles.AsParallel(); }