// Start is called before the first frame update void Start() { var levelSkeletonGeneratorParams = new LevelSkeletonGeneratorParams(); var levelSkeletonGenerator = new LevelSkeletonGenerator(levelSkeletonGeneratorParams); _levelSkeleton = levelSkeletonGenerator.Execute(); var levelSkeletonRenderer = GetComponent <LevelSkeletonRenderer>(); levelSkeletonRenderer.Draw(_levelSkeleton); }
public void Regenerate(LevelSkeletonGeneratorParams levelSkeletonGeneratorParams) { LevelHolder.LevelSkeleton = null; LevelHolder.LevelSkeletonWithBioms = null; LevelHolder.Level = null; var levelSkeletonGenerator = new LevelSkeletonGenerator(levelSkeletonGeneratorParams); LevelHolder.LevelSkeleton = levelSkeletonGenerator.Execute(); if (LevelHolder.LevelSkeleton == null) { Debug.Log("[Failed] generation failed"); return; } var levelSkeletonBiomsGeneratorParams = new LevelSkeletonBiomsGeneratorParams { LevelSkeleton = LevelHolder.LevelSkeleton, MinOpenSpacePerimeter = levelSkeletonGeneratorParams.MinOpenSpacePerimeter, MaxOpenSpacePerimeter = levelSkeletonGeneratorParams.MaxOpenSpacePerimeter }; var levelSkeletonBiomsGenerator = new LevelSkeletonBiomsGenerator(levelSkeletonBiomsGeneratorParams); LevelHolder.LevelSkeletonWithBioms = levelSkeletonBiomsGenerator.Execute(); if (LevelHolder.LevelSkeletonWithBioms == null) { Debug.Log("[Failed] Bioms generation failed"); return; } var levelGeneratorParams = new LevelGeneratorParams() { LevelSkeleton = LevelHolder.LevelSkeletonWithBioms }; var levelGenerator = new LevelGenerator(levelGeneratorParams); LevelHolder.Level = levelGenerator.Execute(); if (LevelHolder.Level == null) { Debug.Log("[Failed] Level generation failed"); return; } Redraw(); }