public override CharacterTask.Task getCurrentTask(CharacterTaskTracker taskTracker) { if (travelAlongPath != null) { if (travelAlongPath.isUseable() && !travelAlongPath.isComplete()) { CharacterTask.Task task = travelAlongPath.getCurrentTask(taskTracker); if (task.taskType == CharacterTask.Type.StepToBlock) { CharacterTask.StepToBlock stepTask = (CharacterTask.StepToBlock)task; Vector3 stepGoal = stepTask.getGoalLoc().toWorldSpaceVector3() + new Vector3(.5f, 0, .5f); stepGoal.Y = boat.getFootLocation().Y; Vector3 newFootLoc = LinearLocationInterpolator.interpolate(boat.getFootLocation(), stepGoal, boat.getSpeed()); newFootLoc.Y = boat.getFootLocation().Y; boat.setFootLocation(newFootLoc); boat.setRotationWithGivenDeltaVec(stepGoal - boat.getFootLocation()); boat.setVelocity(new Vector3()); if (LinearLocationInterpolator.isLinearInterpolationComplete(boat.getFootLocation(), stepGoal, boat.getSpeed())) { stepTask.taskWasCompleted(); } } } else if (travelAlongPath.isComplete()) { travelAlongPath = null; } } return(new CharacterTask.CaptainBoat(boat)); }
public override CharacterTask.Task getCurrentTask(CharacterTaskTracker taskTracker) { if (character.isCarryingItem() && character.getLoad() == ResourceBlock.ResourceType.standardBlock) { if (buildSite.numBlocksLeftToBuild() > 0) { List<BlockLoc> nextBlocksToBuild = buildSite.getAllBlocksToBuild().ToList(); foreach (BlockLoc claimed in taskTracker.blocksCurrentlyClaimed()) { if (nextBlocksToBuild.Contains(claimed)) { nextBlocksToBuild.Remove(claimed); } } BlockLoc blockFoundToBuild; PathHandlerPreferringLowerBlocks pathhandler = new PathHandlerPreferringLowerBlocks(); Path path = pathhandler.getPathToMakeTheseBlocksAvaiable( buildSite.getProfile(), new BlockLoc(character.getFootLocation()), buildSite.getProfile(), nextBlocksToBuild, 2, out blockFoundToBuild); PlaceBlockJob placeBlockJob = new PlaceBlockJob(buildSite, character, blockFoundToBuild, new BuildKickoffJob(buildSite, character, workingProfile), workingProfile, buildSite.getTypeAt(blockFoundToBuild)); TravelAlongPath walkJob = new TravelAlongPath(path, getWaitJobWithReturn(30, placeBlockJob)); ; return new CharacterTask.SwitchJob(walkJob); } else { return new CharacterTask.SwitchJob(new UnemployedJob()); } } else { if (buildSite.numBlocksLeftToBuild() > 0) { List<BlockLoc> nextBlocksToBuild = buildSite.getAllBlocksToBuild().ToList(); foreach (BlockLoc claimed in taskTracker.blocksCurrentlyClaimed()) { if (nextBlocksToBuild.Contains(claimed)) { nextBlocksToBuild.Remove(claimed); } } BlockLoc blockFoundToBuild; PathHandlerPreferringLowerBlocks pathhandler = new PathHandlerPreferringLowerBlocks(); Path path = pathhandler.getPathToMakeTheseBlocksAvaiable( buildSite.getProfile(), new BlockLoc(character.getFootLocation()), buildSite.getProfile(), nextBlocksToBuild, 2, out blockFoundToBuild); //PlaceBlockJob placeBlockJob = new PlaceBlockJob(buildSite, character, location, workingProfile); BuildKickoffJob build = new BuildKickoffJob(buildSite, character, workingProfile); FetchResourceJob fetch = new FetchResourceJob(workingProfile, ResourceBlock.ResourceType.standardBlock, character, build); return new CharacterTask.SwitchJob(fetch); } else { return new CharacterTask.SwitchJob(new UnemployedJob()); } } }
public void cancelPathing() { travelAlongPath = null; }
public void setTravelPath(Path nPath) { travelAlongPath = new TravelAlongPath(nPath); }