Ejemplo n.º 1
0
        /// <summary>
        /// Used, instead, to get a random direction to move.
        /// Lol ;).
        /// </summary>
        /// <returns></returns>
        public override Spell GetSpell()
        {
            if (talkingTo != null)
            {
                if (!talkingTo.LogedIn || !CanSeeSameZ(talkingTo.CurrentPosition))
                {
                    AddChat(Vanish);
                    SetIdle();
                }
                else
                {
                    TurnTowardsTarget(talkingTo);
                    CurrentWalkSettings.Destination = null;
                }
                return(null);
            }

            Direction[] dirs = { Direction.EAST, Direction.SOUTH,
                                 Direction.WEST, Direction.NORTH };
            Direction   dir = dirs[rand.Next(0, dirs.Length)];

            if (GetRange(dir) <= Radius)
            {
                CurrentWalkSettings.IntendingToReachDes = true;
                CurrentWalkSettings.Destination         =
                    Position.GetNewPosition(CurrentPosition, dir);
            }
            return(null);
        }
Ejemplo n.º 2
0
 public virtual void HandleWalk(Creature creature, Direction direction)
 {
     lock (lockThis) {
         Position newPos = Position.GetNewPosition(creature.CurrentPosition, direction);
         HandleMove(creature, newPos, direction);
     }
 }