示例#1
0
 private void InitialMap(int size)
 {
     for (int i = 0; i < size; i++)
     {
         RowDefinition    RD = new RowDefinition();
         ColumnDefinition CD = new ColumnDefinition();
         Map.RowDefinitions.Add(RD);
         Map.ColumnDefinitions.Add(CD);
     }
     CurrentWorld = Game.InitialWorld;
     Game.MoveDirection moveDirection = Game.MoveDirection.Left;
 }
示例#2
0
        private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.Up:
                moveDirection = Game.MoveDirection.Up;
                break;

            case Key.Down:
                moveDirection = Game.MoveDirection.Down;
                break;

            case Key.Left:
                moveDirection = Game.MoveDirection.Left;
                break;

            case Key.Right:
                moveDirection = Game.MoveDirection.Right;
                break;
            }
            CurrentWorld = Game.newWorld(moveDirection, CurrentWorld);
        }