Exemple #1
0
        public void Process(CellGrid cellGrid, VisualGrid visualGrid)
        {
            Debug.Assert(cellGrid != null && visualGrid != null, "Cannot process an AddEvent with a null argument(s).");
            var block = visualGrid.Columns[this.position.x][this.position.y];

            visualGrid.RemoveBuffer.Enqueue(block);
        }
Exemple #2
0
        private void Start()
        {
            this.visualGrid = GetComponent <VisualGrid>();
            this.visualGrid.Build(cellGrid);

            this.scoreManager                = GetComponent <ScoreManager>();
            this.scoreManager.Moves          = Random.Range(8, 12);
            this.scoreManager.ObjectiveType  = (BlockType)Random.Range(0, 3);
            this.scoreManager.ObjectiveCount = Random.Range(25, 30);
        }
Exemple #3
0
        public static Point ToPoint(VisualGrid grid, GameObject block)
        {
            Debug.Assert(grid != null, "Cannot convert to a point when the VisualGrid is null.");
            Debug.Assert(block != null, "Cannot convert a null GameObject into a point.");

            foreach (var column in grid.Columns)
            {
                if (column.Contains(block))
                {
                    var pointX = grid.Columns.IndexOf(column);
                    var pointY = column.IndexOf(block);
                    var point  = new Point {
                        x = pointX, y = pointY
                    };

                    return(point);
                }
            }

            throw new InvalidOperationException("The VisualGrid does not contain the given block.");
        }
Exemple #4
0
 public void Process(CellGrid cellGrid, VisualGrid visualGrid)
 {
     Debug.Assert(cellGrid != null && visualGrid != null, "Cannot process an AddEvent with a null argument(s).");
     this.blockType = cellGrid.Columns[this.position.x][this.position.y].Type;
     visualGrid.InstantiateCellAt(cellGrid, this.blockType, this.position.x);
 }