Exemple #1
0
        public static FoVCache ComputeFoV(EncounterState state, EncounterPosition center, int radius)
        {
            int _x = center.X - radius;
            int _y = center.Y - radius;

            bool[,] visibleCells = new bool[radius * 2 + 1, radius * 2 + 1];

            var visible = rpasCalc.CalcVisibleCellsFrom(center.X, center.Y, radius, state.IsPositionVisible);

            foreach ((int, int)pos in visible)
            {
                if (state.IsInBounds(pos.Item1, pos.Item2))
                {
                    visibleCells[pos.Item1 - _x, pos.Item2 - _y] = true;
                }
            }

            return(new FoVCache(_x, _y, visibleCells));
        }