Esempio n. 1
0
        public ISet <Pos2D> CalculateLineOfSight([NotNull] Actor actor)
        {
            var fov = new ShadowCasterViewProvider(Level);

            fov.ComputeFov(actor.Pos, actor.EffectiveLineOfSightRadius);

            actor.VisibleCells = fov.VisiblePositions;
            actor.MarkCellsAsKnown(fov.VisiblePositions);

            return(actor.VisibleCells);
        }
Esempio n. 2
0
        public IEnumerable <GameCell> GetCellsVisibleFromPoint(Pos2D point, decimal radius)
        {
            var fovCalculator    = new ShadowCasterViewProvider(Level);
            var visiblePositions = fovCalculator.ComputeFov(point, radius);

            foreach (var pos in visiblePositions)
            {
                var cell = Level.GetCell(pos);

                if (cell != null)
                {
                    yield return(cell);
                }
            }
        }