Exemple #1
0
        public Peice[][] SetupPeices()
        {
            var tempGrid = new Peice[8][];

            for (var x = 0; x < 8; x++)
            {
                tempGrid[x] = new Peice[8];
                for (var y = 0; y < 8; y++)
                {
                    var type = PeiceType.Pawn;
                    if (y == 0 || y == 7)
                    {
                        switch (x)
                        {
                        case 0:
                        case 7:
                            type = PeiceType.Castle;
                            break;

                        case 1:
                        case 6:
                            type = PeiceType.Knight;
                            break;

                        case 2:
                        case 5:
                            type = PeiceType.Bishop;
                            break;

                        case 3:
                            type = PeiceType.Queen;
                            break;

                        case 4:
                            type = PeiceType.King;
                            break;
                        }
                    }
                    tempGrid[x][y] = new Peice()
                    {
                        Type = type,
                        X    = x,
                        Y    = y,
                        Side = y > 2 ? Bottom : Top
                    };
                    if (y > 1 && y < 6)
                    {
                        tempGrid[x][y] = null;
                    }
                }
            }
            return(tempGrid);
        }
Exemple #2
0
 public Peice(Peice peice)
 {
     if (peice == null)
     {
         return;
     }
     X         = peice.X;
     Y         = peice.Y;
     HasMoved  = peice.HasMoved;
     IsChecked = peice.IsChecked;
     Side      = peice.Side;
     Type      = peice.Type;
 }