public IFOVBoard Do(Vector2Int origin, Vector2Int dimensions, int sightMod, List <Vector2Int> walls) { m_SightMod = sightMod; m_Board = new FOVBasicBoard(dimensions.x, dimensions.y, walls); m_Board.Visible(origin.x, origin.y); int xMin, xMax, yMin, yMax; if (origin.x < sightMod) { xMin = origin.x; } else { xMin = sightMod; } if (m_Board.Width - origin.x - 1 < sightMod) { xMax = m_Board.Width - origin.x - 1; } else { xMax = sightMod; } if (origin.y < sightMod) { yMin = origin.y; } else { yMin = sightMod; } if (m_Board.Height - origin.y - 1 < sightMod) { yMax = m_Board.Height - origin.y - 1; } else { yMax = sightMod; } //Northeast quadrant CheckQuadrant(m_Board.Vision, origin, new Vector2Int(1, 1), new Vector2Int(xMax, yMax)); //Southeast CheckQuadrant(m_Board.Vision, origin, new Vector2Int(1, -1), new Vector2Int(xMax, yMin)); //Southwest CheckQuadrant(m_Board.Vision, origin, new Vector2Int(-1, -1), new Vector2Int(xMin, yMin)); //Northwest CheckQuadrant(m_Board.Vision, origin, new Vector2Int(-1, 1), new Vector2Int(xMin, yMax)); return(m_Board); }
public FOVBasicBoard Do(Vector2Int origin, Vector2Int dimensions, int visionMod, List <Vector2Int> walls) { m_Board = new FOVBasicBoard(dimensions.x, dimensions.y, walls); m_Board.Visible(origin.x, origin.y); return(m_Board); }
public IFOVBoard Do(Vector2Int origin, Vector2Int dimensions, int visionMod, List <Vector2Int> walls) { Board = new FOVBasicBoard(dimensions.x, dimensions.y, walls); Board.Visible(origin.x, origin.y); Go(origin, 1, visionMod, 0, 359.9d); return(Board); }
public IFOVBoard Do(Vector2Int origin, Vector2Int dimensions, int sightMod, List <Vector2Int> walls) { m_Board = new FOVBasicBoard(dimensions.x, dimensions.y, walls); m_Board.Visible(origin.x, origin.y); foreach (Vector2Int direction in DIAGONALS) { CastLight(origin, sightMod, 1, 1, 0, 0, direction.x, direction.y, 0); CastLight(origin, sightMod, 1, 1, 0, direction.x, 0, 0, direction.y); } return(m_Board); }
public IFOVBoard Do(Vector2Int origin, Vector2Int dimensions, int sightMod, List <Vector2Int> walls) { m_Board = new FOVBasicBoard(dimensions.x, dimensions.y, walls); m_Board.Visible(origin.x, origin.y); UnityEngine.Profiling.Profiler.BeginSample("FOV Calculations"); for (int i = 0; i < 360; i += GRANULARITY) { float x = (float)Math.Cos(i * 0.01745f); float y = (float)Math.Sin(i * 0.01745f); DiscoverTile(x, y, origin, sightMod); } UnityEngine.Profiling.Profiler.EndSample(); return(m_Board); }