protected virtual void Draw(DrawEvent ev, DrawTransformation transform) { TimeSinceDraw.Restart(); float deltaTime = (float)deltaWatch.Elapsed.TotalSeconds; deltaWatch.Restart(); if (deltaTime > 1f) return; using (var ac = BlendMode.Activate()) { for (int i = 0; i < ParticleCount; i++) { particles[i].Age += deltaTime; if (particles[i].Age >= particles[i].Life) { particles[i] = particles[ParticleCount - 1]; ParticleCount--; if (i >= ParticleCount) break; } else { UpdateAndDraw(particles[i], deltaTime, ev.RenderTarget); } } } }
protected virtual void Draw(DrawEvent ev, DrawTransformation transform) { TimeSinceDraw.Restart(); float deltaTime = (float)deltaWatch.Elapsed.TotalSeconds; deltaWatch.Restart(); if (deltaTime > 1f) { return; } using (var ac = BlendMode.Activate()) { for (int i = 0; i < ParticleCount; i++) { particles[i].Age += deltaTime; if (particles[i].Age >= particles[i].Life) { particles[i] = particles[ParticleCount - 1]; ParticleCount--; if (i >= ParticleCount) { break; } } else { UpdateAndDraw(particles[i], deltaTime, ev.RenderTarget); } } } }
public void Draw(DrawEvent ev, DrawTransformation transform) { var player = ((MainScene)Scene).Player; if (player == null) { return; } switch (HintId) { case 0: ev.RenderTarget.DrawTexture(Program.Hint1, transform.WorldCoord.Floor, Program.Foreground * opacity, Vector2.One, (new Vector2(31f, 21f) / 2f).Floor, 0f, new Rectangle(watch.Elapsed.TotalSeconds % 1f > .5 ? new Vector2(31f, 0f) : new Vector2(0f, 0f), new Vector2(31f, 21f))); break; case 1: ev.RenderTarget.DrawTexture(Program.Hint2, transform.WorldCoord.Floor, Program.Foreground * opacity, Vector2.One, (new Vector2(31f, 21f) / 2f).Floor, 0f, new Rectangle(watch.Elapsed.TotalSeconds % 1f > .5 ? new Vector2(31f, 0f) : new Vector2(0f, 0f), new Vector2(31f, 21f))); break; case 2: ev.RenderTarget.DrawTexture(Program.Hint3, transform.WorldCoord.Floor, Program.Foreground * opacity, Vector2.One, (new Vector2(9f, 10f) / 2f).Floor, 0f, new Rectangle(watch.Elapsed.TotalSeconds % 1f > .5 ? new Vector2(9f, 0f) : new Vector2(0f, 0f), new Vector2(9f, 10f))); break; } }