public void CanRetrieveCell() { var cell = _grid.GetCell(0, 0); Assert.IsNotNull(cell); Assert.IsNotNull(_grid.GetCell(new Point(0, 0))); }
public void EmittingCellsUnset_NoBrightnessCells_Left() { SetLightCell(1, 1, 5); Assert.IsTrue(_grid.GetCell(1, 1).LightProperties.Brightness > 0f); UnsetLightCell(1, 1); Assert.IsTrue(_grid.GetCell(1, 1).LightProperties.Brightness == 0f); Assert.IsTrue(_grid.GetCells(a => a.LightProperties.Brightness > 0f).Count() == 0); }
private EmberCell UnsetLightCell(int x, int y) { var cell = _grid.GetCell(x, y); cell.LightProperties.EmitsLight = false; _grid.SetCell(cell); return(cell); }
public void CellsAreExplored_WhenEntityIsNear_LightSource() { // Initialize a blueprint for testing _grid = BaseGrid.Create(new BaseBlueprint()); GridManager.InitializeCustomGrid(_grid); // Create entity and calculate fov + draw it var entity = EntityManager.Create <BaseEntity>(_grid.GetCell(a => a.LightProperties.Brightness > 0f && a.CellProperties.Walkable).Position, _grid); EntityManager.RecalculatFieldOfView(entity); GridManager.Grid.DrawFieldOfView(entity); var cellsWithBrightness = _grid.GetCells(a => a.LightProperties.Brightness > 0f).ToList(); foreach (var cell in cellsWithBrightness) { Assert.IsTrue(cell.CellProperties.IsExplored); } }