public void SetUp() { _fovWindow = new FovWindowMock(); _grid = BaseGrid.Create(_mapSize, _mapSize); GridManager.InitializeCustomGrid(_grid); for (int x = 0; x < _mapSize; x++) { for (int y = 0; y < _mapSize; y++) { if (x >= 1 && y >= 1 && x < _mapSize - 1 && y < _mapSize - 1) { var cell = _grid.GetCell(x, y); cell.CellProperties.IsExplored = true; _grid.SetCell(cell); continue; } // Add walls around the map borders AddWallToGrid(x, y); } } // Add lamp at pos 10x10y AddLampToGrid(10, 10); // Create entity on the grid _entity = EntityManager.Create <BaseEntity>(new Point(1, 1), _grid); _entity.FieldOfViewRadius = Constants.Player.FieldOfViewRadius; }
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); } }
protected virtual void Setup() { _grid = BaseGrid.Create(20, 20); GridManager.InitializeCustomGrid(_grid); }
public void SetUp() { _grid = BaseGrid.Create(10, 10); }
public void SetUp() { _grid = BaseGrid.Create(10, 10); _entity = EntityManager.Create <BaseEntity>(new Point(0, 0), _grid); GridManager.InitializeCustomGrid(_grid); }
protected override void Setup() { // Setup a grid based on a blueprint _grid = BaseGrid.Create(new BaseBlueprint()); GridManager.InitializeCustomGrid(_grid); }