public void AddPathToWalk(Whereabouts w)
        {
            if (PathToWalk.Exists(e => e.Location == w.Location))
            {
                return;
            }

            w.Fraction = 0;
            PathToWalk.Add(w);
            if (Next != null)
            {
                Next.AddPathToWalk(PathToWalk[0]);
            }
        }
Exemple #2
0
        protected bool tryMove(Direction dir)
        {
            if (dir == Direction.None)
            {
                return(false);
            }
            var possibleLocationTo = _whereabouts.Location.Add(dir);

            if (!_pf.CanMoveHere(ref _whereabouts.Floor, _whereabouts.Location, possibleLocationTo))
            {
                return(false);
            }
            _whereabouts.Direction = dir;
            _tail.AddPathToWalk(_whereabouts);
            return(true);
        }