public Path(List<Vector> points, double travelTime) { foreach (Vector v in points) { _spline.AddPoint(v); } _tween = new Tween(0, 1, travelTime); }
public Polygon AddPoint(Point point) { if (_mouseNearFirstVertex) { // Special case on completing the polygon. // _vertexList.Add(_vertexList.First()); Polygon p = new Polygon(_vertexList); _vertexList.Clear(); // reset the highlight _mouseNearFirstVertex = false; _highlightCircleTween = new Tween(0, 0, 0); return p; } else { _vertexList.Add(new PolyVertex(point, new Tween(0, 10, 0.5, Tween.BounceEaseOut))); } return null; }
public PolyVertex(Point point, Tween tween) { Point = point; Tween = tween; }
private void PlayAnimation(double elapsedTime, Tween breakAnimation) { breakAnimation.Update(elapsedTime); foreach (int line in breaks) { for (int i = 0; i <= maxPosX; i++) { grid[i, line].GetBlock().Color = new Engine.Color((float)breakAnimation.Value, (float)breakAnimation.Value, (float)breakAnimation.Value, 1); } } }
private void FinalizeMino(double elapsedTime) { if (!locked) { minoManager.LockMino(); breaks = UpdateBreaks(); locked = true; breakAnimation = new Tween(1, 0, 0.5); gameData.TotalBreaks += breaks.Count; // Update game score switch (breaks.Count) { case 1: gameData.Score += gameData.Level * 40; break; case 2: gameData.Score += gameData.Level * 100; break; case 3: gameData.Score += gameData.Level * 300; break; case 4: gameData.Score += gameData.Level * 1200; break; default: break; } if (breaks.Count > 1) { effectsManager.Play(breaks.Count, grid[0, breaks[0]].Y); } } if (breaks.Count > 0) { if (gameData.TotalBreaks >= 5) { gameData.TotalBreaks = gameData.TotalBreaks % 5; LevelUp(); } PlayAnimation(elapsedTime, breakAnimation); if (breakAnimation.IsFinished()) { BreakLines(breaks); CreateMino(); timer = timeBetweenMoves + 0.3; lockTimer = lockSpeed; locked = false; } } else { CreateMino(); timer = timeBetweenMoves + 0.3; lockTimer = lockSpeed; locked = false; } }
private void HighlightFirstVertex(double elapsedTime, float mouseX, float mouseY) { PolyVertex firstPoint = _vertexList.FirstOrDefault(); _highlightCircleTween.Update(elapsedTime); _hightLightCircle.Radius = _highlightCircleTween.Value(); if (firstPoint == null) { return; } _hightLightCircle.X = firstPoint.Point.X; _hightLightCircle.Y = firstPoint.Point.Y; _hightLightCircle.Radius = 15; // set to max for intersection test if (_hightLightCircle.Intersects(mouseX, mouseY)) { if (_mouseNearFirstVertex == false) { _highlightCircleTween = new Tween(_highlightCircleTween.Value(), 15, 0.4); _mouseNearFirstVertex = true; } } else if (_mouseNearFirstVertex) { _mouseNearFirstVertex = false; _highlightCircleTween = new Tween(_highlightCircleTween.Value(), 0, 0.4); } _hightLightCircle.Radius = _highlightCircleTween.Value(); }
public Effect(Text text) { this.text = text; Color = new Tween(1, 0, 0.5); Movement = new Tween(0, 25, 0.5); }
private void OnLoseFocus() { _focus = false; _highlightTween = new Tween(_highlightTween.Value(), 0, 0.3); }
private void OnGainFocus() { _focus = true; _highlightTween = new Tween(_highlightTween.Value(), _maxRadius, 0.3); }
public HighlightCircle(Point position) { _circle = new Circle(position.X, position.Y, _maxRadius); _highlightTween = new Tween(0, 0, 0); }