示例#1
0
        public FallingObject GetRandomObject()
        {
            int           startX = (this.Field.TopLeftPlayGround.X + this.Field.BottomRightPlayGround.X) / 2;
            int           startY = this.Field.TopLeftPlayGround.Y + 1;
            FallingObject result;

            switch (rand.Next(4))
            {
            case 0:
                result = new FallingL(new Point2D(startX, startY), Rotation.R270, '@',
                                      Game.Colors.Colors[rand.Next(Game.Colors.Colors.Count)]);
                break;

            case 1:
                result = new FallingSquare(new Point2D(startX, startY), Rotation.R0, '@',
                                           Game.Colors.Colors[rand.Next(Game.Colors.Colors.Count)]);
                break;

            case 2:
                result = new FallingLine(new Point2D(startX, startY), Rotation.R0, '@',
                                         Game.Colors.Colors[rand.Next(Game.Colors.Colors.Count)], rand.Next(5) + 1);
                break;

            default:
                result = new FallingZ(new Point2D(startX, startY), Rotation.R0, '@',
                                      Game.Colors.Colors[rand.Next(Game.Colors.Colors.Count)]);
                break;
            }
            return(result);
        }
示例#2
0
 public FallingObject GetRandomObject()
 {
     int startX = (this.Field.TopLeftPlayGround.X + this.Field.BottomRightPlayGround.X)/2;
     int startY = this.Field.TopLeftPlayGround.Y + 1;
     FallingObject result;
     switch (rand.Next(4))
     {
         case 0:
             result = new FallingL(new Point2D(startX, startY), Rotation.R270, '@',
                 Game.Colors.Colors[rand.Next(Game.Colors.Colors.Count)]);
             break;
         case 1:
             result = new FallingSquare(new Point2D(startX, startY), Rotation.R0, '@',
                 Game.Colors.Colors[rand.Next(Game.Colors.Colors.Count)]);
             break;
         case 2:
             result = new FallingLine(new Point2D(startX, startY), Rotation.R0, '@',
                 Game.Colors.Colors[rand.Next(Game.Colors.Colors.Count)], rand.Next(5) + 1);
             break;
         default:
             result = new FallingZ(new Point2D(startX, startY), Rotation.R0, '@',
                 Game.Colors.Colors[rand.Next(Game.Colors.Colors.Count)]);
             break;
     }
     return result;
 }