private List <ChunkFacade> SpawnChunkFacades(SprintRequest sprintRequest) { List <ChunkFacade> chunkFacades = new List <ChunkFacade>(); int chunkNum = sprintRequest.startChunkNum; int endChunkNum = chunkNum - sprintRequest.chunkCount; int offset = sprintRequest.checkpointOverride ? 0 : 1; for (; chunkNum > endChunkNum + offset; --chunkNum) { ChunkRequest chunkRequest = new ChunkRequest() { chunkNum = chunkNum, chunkCount = sprintRequest.totalChunkCount, sprintEndChunkNum = endChunkNum + 1, biome = biomePickingStrategy.Pick(biomes, altitude), }; ChunkFacade chunkFacade = chunkFacadeFactory.Create(chunkRequest); altitude = chunkFacade.Position.y; chunkFacades.Add(chunkFacade); } return(chunkFacades); }
private Checkpoint SpawnCheckpoint(SprintRequest sprintRequest) { ChunkRequest checkpointRequest = new ChunkRequest() { chunkNum = sprintRequest.startChunkNum - sprintRequest.chunkCount + 1, chunkCount = sprintRequest.totalChunkCount, }; Checkpoint checkpoint = checkpointFactory.Create(checkpointRequest, altitude); altitude = checkpoint.Position.y; checkpointManager.AddCheckpoint(checkpoint); return(checkpoint); }
private List <Sprint> SpawnSprints() { List <Sprint> sprints = new List <Sprint>(); lastSprint = null; int currentChunkNum = chunkCount - 1; foreach (SprintRequest sprintRequest in settings.sprintRequests) { SprintRequest currentSprintRequest = new SprintRequest() { chunkCount = sprintRequest.chunkCount, startChunkNum = currentChunkNum, totalChunkCount = chunkCount, checkpointOverride = false }; if (sprints.Count == settings.sprintRequests.Count - 1) { currentSprintRequest.checkpointOverride = true; } currentChunkNum -= sprintRequest.chunkCount; Sprint sprint = sprintFactory.Create(currentSprintRequest); if (lastSprint == null) { checkpointManager.CurrentCheckpoint = sprint.Checkpoint; } else { lastSprint.Checkpoint.NextCheckpoint = sprint.Checkpoint; } if (sprints.Count == settings.sprintRequests.Count - 1) { secondLastSprint = lastSprint; } lastSprint = sprint; sprints.Add(sprint); } return(sprints); }
public Sprint Create(SprintRequest sprintRequest) { List <ChunkFacade> chunkFacades = SpawnChunkFacades(sprintRequest); Checkpoint checkpoint = null; if (!sprintRequest.checkpointOverride) { checkpoint = SpawnCheckpoint(sprintRequest); } List <TypeValuePair> args = new List <TypeValuePair>(); args.Add(InstantiateUtil.CreateTypePair <List <ChunkFacade> >(chunkFacades)); args.Add(InstantiateUtil.CreateTypePair <Checkpoint>(checkpoint)); Sprint sprint = container.InstantiateExplicit <Sprint>(args); sprint.Initialize(); return(sprint); }