Exemplo n.º 1
0
        private void UpdateFOVBoard()
        {
            bool passable;
            bool gridChecked;

            if (checkPosition.Count < 1)
            {
                return;
            }

            position = checkPosition.Pop();
            x        = position[0];
            y        = position[1];

            surround = coordinate.SurroundCoord(Surround.Diagonal, x, y);

            foreach (var grid in surround)
            {
                if (!board.IsInsideRange(FOVShape.Rhombus,
                                         maxRange,
                                         coordinate.Convert(transform.position),
                                         grid))
                {
                    continue;
                }

                passable = board.CheckBlock(SubObjectTag.Floor, grid) ||
                           board.CheckBlock(SubObjectTag.Pool, grid);

                gridChecked = fovTest
                    ? (!fov.CheckFOV(FOVStatus.TEST, grid))
                    : (!fov.CheckFOV(FOVStatus.Insight, grid));

                if (passable && gridChecked)
                {
                    checkPosition.Push(grid);
                }

                if (fovTest)
                {
                    fov.ChangeFOVBoard(FOVStatus.TEST, grid);
                }
                else
                {
                    fov.ChangeFOVBoard(FOVStatus.Insight, grid);
                }
            }

            UpdateFOVBoard();
        }
Exemplo n.º 2
0
        private void UpdateFOVBoard()
        {
            bool shape;
            bool lighted;

            for (int i = 0; i < board.Width; i++)
            {
                for (int j = 0; j < board.Height; j++)
                {
                    position = new int[] { i, j };

                    shape = board.IsInsideRange(FOVShape.Rhombus,
                                                maxRange, source, position);
                    lighted = distanceBoard[i, j] <= maxRange;

                    if (shape && lighted)
                    {
                        fov.ChangeFOVBoard(FOVStatus.Insight, position);
                    }
                }
            }
        }