/// <summary>
        /// The method responsible for generating a new figure (used by the engine of the game)
        /// </summary>
        /// <param name="position">The position on which to be put the new generated figure</param>
        /// <returns>The generated figure</returns>
        public Figure GenerateFigure(Position position)
        {
            switch (this.randomGenerator.Next(1, 9))
            {
                case 1: return new LeftG(position);
                case 2: return new LeftS(position);
                case 3: return new Line(position);
                case 4: return new RightS(position);
                case 5: return new Square(position);
                case 6: return new TFigure(position);
                case 7: return new UFigure(position);
                case 8: return new XFigure(position);
                default: return new Line(position);

            }
        }
Пример #2
0
 /// <summary>
 /// The default constructor for the figure initialization
 /// </summary>
 /// <param name="position">The position of the figure on the game field</param>
 public UFigure(Position position)
     : base(position, new char[,] { { '#', ' ', '#' }, { '#', '#', '#' } })
 {
 }
Пример #3
0
 /// <summary>
 /// The main constructor of a game objects.
 /// </summary>
 /// <param name="position">The position of the game object on the field</param>
 /// <param name="image">The visible part of the object, in the form of a char matrix </param>
 public GameObject(Position position, char[,] image)
 {
     this.image = (char[,])image.Clone();
     this.position = position;
 }
Пример #4
0
 /// <summary>
 /// The default constructor for the figure initialization
 /// </summary>
 /// <param name="position">The position of the figure on the game field</param>
 public RightS(Position position)
     : base(position, new char[,] { { ' ', '#', '#' }, { '#', '#', ' ' } })
 {
 }
Пример #5
0
 /// <summary>
 /// The default constructor for the figure initialization
 /// </summary>
 /// <param name="position">The position of the figure on the game field</param>
 public Square(Position position)
     : base(position, new char[,] { { '#', '#' }, { '#', '#' } })
 {
 }
Пример #6
0
 /// <summary>
 /// The default constructor for the figure initialization
 /// </summary>
 /// <param name="position">The position of the figure on the game field</param>
 public LeftG(Position position)
     : base(position, new char[,] { { '#', '#' }, { ' ', '#' }, { ' ', '#' } })
 {
 }
Пример #7
0
 /// <summary>
 /// The default constructor for the figure initialization
 /// </summary>
 /// <param name="position">The position of the figure on the game field</param>
 public Line(Position position)
     : base(position, new char[,] { { '#' }, { '#' }, { '#' }, { '#' } })
 {
 }
Пример #8
0
 /// <summary>
 /// The constructor which initializes the figures properties
 /// </summary>
 /// <param name="position">The position of the figure in the game</param>
 /// <param name="image">The visual part(the image) if the figure, represented by char matrix</param>
 public Figure(Position position, char[,] image)
     : base(position, image)
 {
 }
Пример #9
0
        protected Timer timer2; //快速下落后销毁方块

        #endregion Fields

        #region Constructors

        public Box(GameFrame gf)
        {
            this.gFrame = gf;
            isActive = false;
            center = new Position(2, gFrame.Column / 2);
        }
Пример #10
0
 public Square(string p)
 {
     string[] s = p.Split('.');
     pos = new Position(System.Int32.Parse(s[0]), System.Int32.Parse(s[1]));
     value = (BoxShape)(System.Int32.Parse(s[2]));
 }
Пример #11
0
        public BoxShape value; //种类

        #endregion Fields

        #region Constructors

        public Square(Position p, BoxShape v)
        {
            this.pos = p;
            this.value = v;
        }