Esempio n. 1
0
 public void Merge(IPartialGrid <TData> other)
 {
     foreach (var cell in other)
     {
         _data[cell.pos.row, cell.pos.col] = cell.data;
     }
 }
Esempio n. 2
0
        public bool DoesCollideWith(IPartialGrid <TData> other)
        {
            foreach (var cell in other)
            {
                if (IsPositionOccupied(cell.pos))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 3
0
        public bool IsGridInBounds <T>(IPartialGrid <T> grid) where T : IEquatable <T>
        {
            foreach (var cell in grid)
            {
                if (cell.pos.row < 0 || cell.pos.row >= _rows || cell.pos.col < 0 || cell.pos.col >= _cols)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 4
0
 /// <summary>
 /// Send merge command to the view. Will add parameter grid to the existing view structure of specific grid type.
 /// Will transform grid based on injected IGridTransform.
 /// </summary>
 /// <param name="type"></param>
 /// <param name="grid"></param>
 public void DispatchMergeGrid(GridType type, IPartialGrid <CellDataModel> grid)
 {
     mergeGridInView.Dispatch(type, transform.GridToWorld(grid.pos), MapToViewData(grid));
 }
Esempio n. 5
0
 public Vector3 GridWorldCentroid <T>(IPartialGrid <T> grid) where T : IEquatable <T>
 {
     return(GridToWorld((float)grid.pos.row + grid.rows / 2f, (float)grid.pos.col + grid.cols / 2f));
 }
Esempio n. 6
0
 public IEnumerable <Vector3> TransformGridToWorldPoints <T>(IPartialGrid <T> grid) where T : IEquatable <T>
 {
     return(grid.Select(a => GridToWorld(a.pos)));
 }