Esempio n. 1
0
 void OnKeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     Vector2 newrun = run;
     if (e.KeyCode == Program.Instance.Keybindings[-10]) newrun.Y = -1;
     if (e.KeyCode == Program.Instance.Keybindings[-9]) newrun.X = -1;
     if (e.KeyCode == Program.Instance.Keybindings[-8]) newrun.Y = 1;
     if (e.KeyCode == Program.Instance.Keybindings[-7]) newrun.X = 1;
     if (newrun.X != run.X || newrun.Y != run.Y)
     {
         run = newrun;
         Program.Instance.NetworkOut.StartRun(Program.Instance.ServerEndpoint, newrun.X, newrun.Y);
     }
     if (e.KeyCode == System.Windows.Forms.Keys.Space) Program.Instance.NetworkOut.Jump(Program.Instance.ServerEndpoint);
     if (e.KeyCode == System.Windows.Forms.Keys.Tab) Program.Instance.NetworkOut.NextTarget(Program.Instance.ServerEndpoint);
     if (e.KeyCode == System.Windows.Forms.Keys.P)
     {
         Common.GameStats stats = new Common.GameStats();
         stats.AddPlayer("Albe0", "Albert", 2);
         stats.AddPlayer("Herb0", "Herbert", 1);
         Program.Instance.ChangeState(new EndOfGameState()
             {
                 VictoryText = "Test successful",
                 GameStats = stats
             });
     }
     if (e.KeyCode == System.Windows.Forms.Keys.Escape)
     {
         GameScene.StopTargetGround();
     }
 }