You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.7 KiB
78 lines
1.7 KiB
using System; |
|
using TEC.Model; |
|
using System.Windows.Forms; |
|
|
|
namespace TEC |
|
{ |
|
public class Program |
|
{ |
|
public static void Main() |
|
{ |
|
Player[] players = new Player[2]; |
|
|
|
Human player1 = new Human(); |
|
Alien player2 = new Alien(); |
|
|
|
player1.SetPosition(3, 3); |
|
player2.SetPosition(55, 3); |
|
|
|
players[0] = player1; |
|
players[1] = player2; |
|
|
|
Game g = new Game(players); |
|
g.eventPlayersOnSamePoint += OnRaise_eventPlayersOnSamePoint; |
|
|
|
g.PrintField(); |
|
|
|
ConsoleKeyInfo key; |
|
bool isReadingKeys = true; |
|
while (isReadingKeys) |
|
{ |
|
key = Console.ReadKey(); |
|
|
|
if (key.Key == ConsoleKey.Q) |
|
{ |
|
isReadingKeys = false; |
|
} |
|
|
|
if (key.Key == ConsoleKey.RightArrow) |
|
{ |
|
g.MoveMainPlayer(Game.Movement.Forward); |
|
} |
|
if (key.Key == ConsoleKey.LeftArrow) |
|
{ |
|
g.MoveMainPlayer(Game.Movement.Backward); |
|
} |
|
} |
|
} |
|
|
|
static void OnRaise_eventPlayersOnSamePoint() |
|
{ |
|
//Console.WriteLine("BOOM"); |
|
Console.Beep(); |
|
|
|
MessageBox.Show( |
|
"БУМ", |
|
"Что-то произошло", |
|
System.Windows.Forms.MessageBoxButtons.YesNo, |
|
System.Windows.Forms.MessageBoxIcon.Warning, |
|
System.Windows.Forms.MessageBoxDefaultButton.Button2); |
|
|
|
System.Windows.Forms.Form frm = new System.Windows.Forms.Form(); |
|
frm.FormBorderStyle = FormBorderStyle.FixedDialog; |
|
frm.MaximizeBox = false; |
|
frm.MinimizeBox = false; |
|
frm.StartPosition = FormStartPosition.CenterScreen; |
|
|
|
System.Windows.Forms.Button btn1 = new System.Windows.Forms.Button(); |
|
btn1.Width = 80; |
|
btn1.Height = 30; |
|
btn1.Location = new System.Drawing.Point(10, 10); |
|
btn1.Text = "test"; |
|
|
|
frm.Controls.Add(btn1); |
|
|
|
frm.ShowDialog(); |
|
} |
|
} |
|
} |