public SpaceshipGameObject(Position position, Size size, IGameRenderer renderer) : base(position, size) { this.renderer = renderer; }
public MegaHadoukenGameObject(Position position, Size size) : base(position, size) { }
public HadoukenGameObject(Position position, Size size) : base(position, size) { this.DefaultDirection = DirectionByDefault; }
private Image CreateImageForCanvas(string path, Position position, Size size) { Image image = new Image(); BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.UriSource = new Uri(path, UriKind.RelativeOrAbsolute); bitmap.EndInit(); image.Source = bitmap; image.Width = size.Width; image.Height = size.Height; Canvas.SetLeft(image, position.Left); Canvas.SetTop(image, position.Top); return image; }
private void AddToCanvas(string imagePath, Position position, Size size) { var image = this.CreateImageForCanvas(imagePath, position, size); this.canvas.Children.Add(image); }
public void Stop() { this.gameWindow.KeyDown -= this.HandleMoveShipEvent; this.gameWindow.KeyDown -= this.HandleShipStartsFireEvent; this.gameWindow.KeyUp -= this.HandleShipStopsFireEvent; this.gameWindow.KeyDown += this.HandleRestartGameEvent; //Draw GameOver var gameOverPosition = new Position(this.GameoverLeft, this.GameoverTop); var gameOverSize = new Size(GameoverWidth, GameoverHeight); this.AddToCanvas(GameoverImagePath, gameOverPosition, gameOverSize); }
public GameObject(Position position, Size size) { this.Position = position; this.Size = size; this.IsAlive = true; }