Пример #1
0
        public virtual bool NotifyStartMoving(Path path)
        {
            if (path.IsEmpty())
            {
                logger.Warn("Try to start moving with an empty path");
                return false;
            }

            Movement = new MovementBehavior(path, GetAdaptedVelocity(path));
            Movement.Start();


            return NotifyStartMoving(Movement);
        }
Пример #2
0
        public bool Move(Path path, Cell dest, bool cancelMove = true)
        {
            if (IsMoving())
                if (cancelMove)
                    CancelMove(false);
                else
                {
                    if (_actionAfterMove != null) return false; // Can't remember this move
                    _actionAfterMove = () => Move(path, dest, cancelMove);
                    return true;
                }

            // DEBUG
            //SendMessage(String.Format("Move {0} => {1} : {2}", Cell, dest, String.Join<Cell>(",", path.Cells)));
            //ResetCellsHighlight();
            //HighlightCells(path.Cells, Color.YellowGreen);
            if (path.IsEmpty())
            {
                SendMessage("Empty path skipped", Color.Gray);
                return false;
            }
            else
                if (path.Start.Id != Cell.Id)
                {
                    SendMessage(String.Format("Path start with {0} instead of {1}", path.Start, Cell), Color.Red);
                    return false;
                }

            Bot.SendToServer(new GameMapMovementRequestMessage(path.GetClientPathKeys(), Map.Id));
            return true;

        }
Пример #3
0
        public bool Move(Path path)
        {
            if (!IsPlaying())
                return false;

            if (Stats.CurrentMP < 1)
            {
                Character.SendMessage(String.Format("Can't move with {0} MP", Stats.CurrentMP), Color.Red);
                return false;
            }

            // DEBUG
            //Character.SendMessage(String.Format("Move {0} => {1} ({3} PM): {2}", Cell, cell, String.Join<Cell>(",", path.Cells), mp));
            //Character.ResetCellsHighlight();
            //Character.HighlightCells(path.Cells, Color.YellowGreen);
            if (path == null || path.IsEmpty())
            {
                Character.SendMessage("Empty path skipped", Color.Red);
                return false;
            }
            else
                if (path.Start.Id != Cell.Id)
                {
                    Character.SendMessage(String.Format("Path starts with {0} instead of {1}", path.Start, Cell), Color.Red);
                    return false;
                }

            if (NotifyStartMoving(path))
                Character.Bot.SendToServer(new GameMapMovementRequestMessage(path.GetClientPathKeys(), Map.Id));

            return true;
        }