Ejemplo n.º 1
0
        public void receiveKeyPress(Keys k)
        {
            if (k.Equals(Keys.Left))
            {
                Player.Turn(Direction.LEFT);
            }
            if (k.Equals(Keys.Right))
            {
                Player.Turn(Direction.RIGHT);
            }
            if (k.Equals(Keys.Space))
            {
                if (Board.GameOver)
                {
                    StartGame();
                    Board.Paused = false;
                }
                else
                {
                    Board.Paused = !Board.Paused;
                }
            }
            if (k.Equals(Keys.Escape))
            {
                if (!Board.Paused)
                {
                    Board.Paused = true;
                }
                else
                {
                    ShouldQuit = true;
                }
            }

            if (k.Equals(Keys.Up) && debug)
            {
                SnakeMod.monitor.Log(Player.position.ToString() + ":" + Player.GetBoxPosition().ToString() + ":" + Board.nextCollectible.position.ToString());
            }
            if (k.Equals(Keys.Down) && debug)
            {
                Player.AddNewTailSegment();
            }
            if (k.Equals(Keys.F5))
            {
                debug = !debug;
            }
            if (k.Equals(Keys.F6))
            {
                hideObjects = !hideObjects;
            }
        }