public bool CanReach(LevelCell cell, bool ignoreDoor) { for (int i = 0; i < Neighbors.Length; i++) { if (Neighbors[i] == cell) { var dir = (DirectionsEight)i; return(CanExit(dir, ignoreDoor)); } } return(false); }
public DirectionsEight GetTravelDir(LevelCell cell) { for (int i = 0; i < _neighbors.Length; i++) { if (_neighbors[i] == cell) { var dir = (DirectionsEight)i; return(dir); } } return(DirectionsEight.Top); }
public void SetWalkable(LevelCell c) { _threadLock.EnterWriteLock(); var p3 = new Point3(c.WorldPositionV3); var size = Game.MapCellSize / 2; for (int x = -size; x <= size; x++) { for (int z = -size; z <= size; z++) { var pos = new Point3(p3.x + x, p3.y, p3.z + z); if (!c.Walkable) { SetWalkableInternal(pos, false); continue; } var checkDir = new bool[4]; if (x == -size) { checkDir[3] = true; } if (z == -size) { checkDir[2] = true; } if (x == size) { checkDir[1] = true; } if (z == size) { checkDir[0] = true; } bool walkable = true; for (int i = 0; i < checkDir.Length; i++) { if (!checkDir[i]) { continue; } if (!c.CanExit((Directions)i)) { walkable = false; break; } } SetWalkableInternal(pos, walkable); } } _threadLock.ExitWriteLock(); }
public void UpdateCellMapVisible(LevelCell cell) { if (Cells.Contains(cell)) { return; } //if (cell.HasActor()) { // for (int i = 0; i < cell.Actors.Count; i++) { // var actor = cell.Actors[i]; // if (actor != null) { // AddWatch(actor, true); // } // } //} cell.IsVisible = true; Cells.Add(cell); }