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 void ComputeSpiralPath() { ChunkManager chunkManager = stateMachine.ChunkManager; path = new Vector3[chunkManager.ChunkCount - 1]; int i = 0; ChunkFacade previousChunkFacade = chunkManager.PeakChunkFacade.PreviousChunkFacade; while (previousChunkFacade != null) { if (previousChunkFacade.PreviousChunkFacade == null) { StartingZoneView startingZoneView = previousChunkFacade.ChunkView.GetComponentInChildren <StartingZoneView>(); path[i] = startingZoneView.NormalSpawn.Position; } else { path[i] = previousChunkFacade.ChunkView.Position + (Vector3.up * previousChunkFacade.ChunkView.ChunkFeatureView.EntryAltitude); } i++; previousChunkFacade = previousChunkFacade.PreviousChunkFacade; } }
private ChunkFacade SpawnStartingChunkFacade() { ChunkRequest chunkRequest = new ChunkRequest() { chunkNum = chunkCount, chunkCount = chunkCount, sprintEndChunkNum = chunkCount, biome = settings.startingZoneBiome, }; ChunkFacade chunkFacade = chunkFacadeFactory.Create(chunkRequest); chunkFacade.Name = "Starting Zone"; return(chunkFacade); }
private void LinkChunks() { ChunkFacade previousChunkFacade = startingChunkFacade; foreach (Sprint sprint in sprints) { foreach (ChunkFacade chunkFacade in sprint.ChunkFacades) { chunkFacade.PreviousChunkFacade = previousChunkFacade; previousChunkFacade = chunkFacade; } } foreach (ChunkFacade chunkFacade in peakChunkFacades) { chunkFacade.PreviousChunkFacade = previousChunkFacade; previousChunkFacade = chunkFacade; } }
public Checkpoint Create(ChunkRequest chunkRequest, float altitude) { ChunkRequest checkpointRequest = new ChunkRequest() { chunkNum = chunkRequest.chunkNum, chunkCount = chunkRequest.chunkCount, sprintEndChunkNum = chunkRequest.sprintEndChunkNum, biome = biomePickingStrategy.Pick(biomes, altitude), }; ChunkFacade chunkFacade = chunkFacadeFactory.Create(checkpointRequest); Checkpoint checkpoint = container.Instantiate <Checkpoint>(checkpointNum, chunkFacade); checkpointNum++; checkpoint.Initialize(); return(checkpoint); }
public Checkpoint( int checkpointNum, ChunkFacade chunkFacade, SpawnManager spawnManager, CheckpointManager checkpointManager, AetherManager aetherManager, InputManager inputManager, PlayerManager playerManager, ReadySetGoManager readySetGoManager, DeathManager deathManager) { this.checkpointNum = checkpointNum; this.chunkFacade = chunkFacade; this.spawnManager = spawnManager; this.checkpointManager = checkpointManager; this.aetherManager = aetherManager; this.inputManager = inputManager; this.playerManager = playerManager; this.readySetGoManager = readySetGoManager; this.deathManager = deathManager; }
public void Initialize() { ChunkFacade startingChunkFacade = chunkManager.StartingChunkFacade; StartingZoneView startingZoneView = startingChunkFacade.ChunkView.GetComponentInChildren <StartingZoneView>();; spawnManager.CurrentSpawnView = startingZoneView.InitialSpawn.GetComponentInChildren <SpawnView>(); gameStateTrigger.Fire(GameStateType.Play); foreach (Input input in gameStateMachine.GameReadyState.SelectedInputs) { PlayerFacade playerFacade = playerManager.SpawnPlayer(input, gameStateMachine.GameReadyState.ChosenCharacterType(input)); deathManager.AddPlayer(input); float randomFactor = Mathf.Pow(UnityEngine.Random.value * 2, 2) / 4; playerFacade.Position += Vector3.up * randomFactor * settings.spawnAltitudeRange; playerFacade.Freefall(); playerFacade.Player.Gravity = 1f; playerFacade.MoveDirection = Vector3.zero; playerFacade.ProbeGround(); } spawnManager.CurrentSpawnView = startingZoneView.NormalSpawn.GetComponentInChildren <SpawnView>(); cameraView.IsActive = true; cameraAnchorManager.ResetAnchor(); cameraManager.ResetCamera(); deathManager.IsActive = true; mistManager.IsActive = true; mistManager.UpdateMistPosition(spawnManager.CurrentSpawnView.Position.y); rankManager.IsActive = true; aetherManager.GameTimer = Time.time; }
private List <ChunkFacade> SpawnPeakChunkFacades() { List <ChunkFacade> peakChunkFacades = new List <ChunkFacade>(); for (int chunkNum = settings.peakChunkCount - 1; chunkNum >= 0; --chunkNum) { ChunkRequest chunkRequest = new ChunkRequest() { chunkNum = chunkNum, chunkCount = chunkCount, sprintEndChunkNum = 0, biome = settings.peakBiome, }; ChunkFacade chunkFacade = chunkFacadeFactory.Create(chunkRequest); chunkFacade.Name = "Peak"; peakChunkFacades.Add(chunkFacade); } return(peakChunkFacades); }
public void ResetVariables() { chunkCount = CountChunks() + settings.peakChunkCount; startingChunkFacade = SpawnStartingChunkFacade(); cinematicManager.StartingZoneView = startingChunkFacade.ChunkView.GetComponentInChildren <StartingZoneView>(); sprints = SpawnSprints(); sprintManager.SetSprintCount(sprints.Count); peakChunkFacades = SpawnPeakChunkFacades(); peakChunkFacade = peakChunkFacades[peakChunkFacades.Count - 1]; peakZoneView = peakChunkFacade.ChunkView.GetComponentInChildren <PeakZoneView>(); cinematicManager.PeakZoneView = peakZoneView; peakCheckpoint = SpawnPeakCheckpoint(); checkpointManager.LastCheckpoint = peakCheckpoint; lastSprint.Checkpoint = peakCheckpoint; secondLastSprint.Checkpoint.NextCheckpoint = lastSprint.Checkpoint; LinkChunks(); gameStateMachine.ChunkManager = this; }