public void StartTracks(Coaster coaster) { List <BuildAction> buildActions = new List <BuildAction>(); //Stright for (int i = 0; i < (22); i++) { buildActions.Add(new BuildAction(TrackType.Stright)); } //Left for (int i = 0; i < (4 * 3); i++) { buildActions.Add(new BuildAction(TrackType.Left)); } //Stright 5 for (int i = 0; i < (11); i++) { buildActions.Add(new BuildAction(TrackType.Stright)); } BuildTracks(buildActions, coaster); coaster.NewChunks[coaster.NewChunkCount] = (coaster.NewTrackCount); coaster.NewChunkCount++; coaster.Merge(true); coaster.TracksStarted = true; }
public bool ProcessAfterBuildAttempt(Coaster coaster, TaskResults results, string lastTaskName = "") { this.lastTaskName = lastTaskName; if (results != TaskResults.Successful) { coaster.Reset(); } switch (results) { case TaskResults.MaxX: results = FixX.Run(coaster); break; case TaskResults.MaxY: results = FixY.Run(coaster); break; case TaskResults.MinX: results = FixX.Run(coaster); break; case TaskResults.MinY: results = FixY.Run(coaster); break; case TaskResults.MinZ: results = FixZ.Run(coaster); break; case TaskResults.Collison: results = FixTrackCollison.Run(coaster); break; } if (results == TaskResults.Successful) { //Chunk anything that has not already been Chunked int totalNewTracksChunked = 0; for (int i = 0; i < coaster.NewChunkCount; i++) { totalNewTracksChunked += coaster.NewChunks[i]; } int tracksWihtNoChunk = coaster.NewTrackCount - totalNewTracksChunked; if (tracksWihtNoChunk > 0) { coaster.NewChunks[coaster.NewChunkCount] = tracksWihtNoChunk; coaster.NewChunkCount++; } lastBuildActionFail = false; coaster.Merge(); return(true); } else { lastBuildActionFail = true; coaster.Reset(); return(false); } }