/// <summary> /// We need an internal ProcessMove method to avoid altering the original path. /// </summary> /// <param name="unit"></param> /// <param name="nextLeg"></param> /// <returns></returns> private bool ProcessMoveInternal(CharacterBase unit, Location nextLeg) { //check that the map is empty at the desired location if (!_map.ReserveIfEmpty(nextLeg, unit)) return false; MoveAction moveAction = new MoveAction { Tick = _timeKeeper.Tick + unit.MovementSpeed, Location = nextLeg }; unit.BeginMove(nextLeg); AddAction(unit, moveAction); return true; }
private void MoveActionHandler(CharacterBase unit, MoveAction action) { Location oldLocation = unit.Location; Location newLocation = action.Location; _map.Move(unit, oldLocation, newLocation); //unit.EndMove(action.Location); unit.Ready(action); }