Exemplo n.º 1
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);
 }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }