public override void Update(TimeSpan elapsed) { GraphicsDevice device = GameContainer.Graphics.GraphicsDevice; current = origin; if (currentDisplay != null) { if (!movingToCorner) { if (up) { currentScale += 2.1f * (float)elapsed.TotalSeconds; } else { currentScale -= 1.75f * (float)elapsed.TotalSeconds; } if (currentScale > 1.25f) { up = false; } if (currentScale < 0.75f) { up = true; } tmpPosition = new Vector2( (device.Viewport.Width / 2) - ((currentDisplay.Icon.Width * currentScale) / 2), (device.Viewport.Height / 2) - ((currentDisplay.Icon.Height * currentScale) / 2)); } else { tmpPosition += Vector2.Normalize(new Vector2(1, 0.75f)) * (float)elapsed.TotalSeconds; currentScale -= 0.75f * (float)elapsed.TotalSeconds; if (currentScale < 0.25f) { currentDisplay = null; } } TimeSpan since = DateTime.Now - from; if (since.TotalSeconds > displayTime) { movingToCorner = true; } } }
public void Add(AchievementMetaData meta) { if (!wins.Contains(meta)) { wins.Add(meta); currentDisplay = meta; currentScale = 1; up = true; movingToCorner = false; from = DateTime.Now; } }