public Bullet(TOwner owner, int xCoord, int yCoord, SquareTable table, Direction direction) : base(null, null, xCoord, yCoord, table) { Direction = direction; bulletUi = new Rectangle(); bulletUi.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; bulletUi.VerticalAlignment = System.Windows.VerticalAlignment.Top; if (typeof(TTarget) == typeof(Ghost)) { bulletUi.Fill = new SolidColorBrush(Color.FromRgb(255, 0, 0)); } else { bulletUi.Fill = new SolidColorBrush(Color.FromRgb(115, 220, 24)); } Canvas.SetLeft(GameTable.UiContainer, GameTable.BaseSquareSize.Width * xCoord); Canvas.SetTop(GameTable.UiContainer, GameTable.BaseSquareSize.Height * yCoord); table.UiContainer.Children.Add(bulletUi); ChangeDirection(direction); base.UiContainer = bulletUi; Timer = new DispatcherTimer(); Timer.Interval = new TimeSpan(0, 0, 0, 0, 700); Timer.Tick += Timer_Tick; Timer.Start(); }
public Ghost(Player playerItem, int xCoord, int yCoord, UIElement uiElement, SquareTable table) : base(null, uiElement, xCoord, yCoord, table) { GhostTimer = new DispatcherTimer(); Player = playerItem; GhostTimer.Interval = new TimeSpan(0, 0, 0, 0, 500); GhostTimer.Tick += Timer_Tick; GhostTimer.Start(); BulletDodgeReactionTimer = new DispatcherTimer(); BulletDodgeReactionTimer.Interval = new TimeSpan(0, 0, 0, 0, 50); BulletDodgeReactionTimer.Tick += BulletDodgeReactionTimer_Tick; BulletDodgeReactionTimer.Start(); }
public MainWindow() { Timer = new DispatcherTimer(); Timer.Interval = new TimeSpan(0, 0, 0, 0, 10000); Timer.Tick += Timer_Tick; InitializeComponent(); Table = new SquareTable(new Size(30, 30), new Point(0, 0), new Size(60, 30), Container); Reset(); Table.GameOver += Table_GameOver; Table.LevelWon += Table_LevelWon; Timer.Start(); }