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); }
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); } }
public void CellsAreNotExplored_EvenWhen_AreaHasLights() { // 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>(new Point(1, 1), _grid); EntityManager.RecalculatFieldOfView(entity); GridManager.Grid.DrawFieldOfView(entity); var cellsWithBrightness = _grid.GetCells(a => a.LightProperties.Brightness > 0f).ToList(); foreach (var cell in cellsWithBrightness) { Assert.IsFalse(cell.CellProperties.IsExplored); } }