Beispiel #1
0
 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);
 }
Beispiel #2
0
 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);
 }
Beispiel #3
0
        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();
        }
Beispiel #4
0
 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);
 }