예제 #1
0
        public void Update()
        {
            YOffset++;
            if (YOffset == ScaleHelper.ScaleHeight(Block.BlockHeight) - 1)
            {
                // Get a new random row
                Row randomRow = Row.RandomRow(this);

                // Insert into position 0 on both the rows and columns (its just easier this way)
                rows.Insert(0, randomRow);
                for (var i = 0; i < columns.Length; i++)
                {
                    columns[i].Insert(0, randomRow[i]);
                    columnIsDirty[i] = true;
                }

                YOffset = 0;
            }

            // Check for matches in rows/columns
            DoMatchChecking();

            // Update our rows
            foreach (Row r in rows)
            {
                r.Update();
            }
        }
        public void Update()
        {
            YOffset++;
            if (YOffset == ScaleHelper.ScaleHeight(Block.BlockHeight) - 1)
            {
                rows.Insert(0, Row.RandomRow(this));
                YOffset = 0;
            }

            // Update our rows
            foreach (Row r in rows)
            {
                r.Update();
            }
        }
예제 #3
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        protected override void Update(GameTime gameTime)
        {
            count++;
            if (count == 53)
            {
                rows.Add(Row.RandomRow());
                count = 0;
            }
            foreach (Row r in rows)
            {
                r.Update();
            }

            base.Update(gameTime);
        }