private static bool CompareGenerationSteps(GenerationStep g1, GenerationStep g2) { var c1 = g1.RequiredComponents.ToList(); var c2 = g2.RequiredComponents.ToList(); if (c1.Count != c2.Count) { return(false); } for (int i = 0; i < c1.Count; i++) { if (c1[i].ComponentType.FullName != c2[i].ComponentType.FullName) { return(false); } if (c1[i].Tag != c2[i].Tag) { return(false); } } return(g1.Name == g2.Name); }
void RunStep() { switch (Step) { case GenerationStep.Initialize: _template.SetRandom(_rand); _template.Initialize(); _collision = new RoomCollision(); _rootRoom = null; _rooms = new List <Room>(); break; case GenerationStep.TargetGeneration: if (!GenerateTarget()) { Step = GenerationStep.Initialize; return; } break; case GenerationStep.SpecialGeneration: GenerateSpecials(); break; case GenerationStep.BranchGeneration: GenerateBranches(); break; } Step++; }
public void Generate(GenerationStep? targetStep = null) { while (Step != targetStep && Step != GenerationStep.Finish) { RunStep(); } }
public GenerationPipeline Build(GenerationStep step) { var steps = step.AllLessThanOrEqualThis() .Select(it => generators[it]) .ToList(); return(new GenerationPipeline(steps)); }
public CaveGenerator() { output = null; sceneCamera = null; wallsMeshFilter = null; step = GenerationStep.Cells; width = 120; height = 40; randomFillPercent = 45; smoothSteps = 5; maxActiveNeighbors = 4; neighboursRadio = 1; squadSide = 1; rendererService = new RendererService(); pipelineBuilder = new GenerationPipelineBuilder(); removeRegionsSize = 5; borderSize = 1; }
public Generator(int seed, DungeonTemplate template) { _rand = new Random(seed); this._template = template; Step = GenerationStep.Initialize; }
private void RunStep() { switch (Step) { case GenerationStep.Initialize: template.SetRandom(rand); template.Initialize(); collision = new RoomCollision(); rootRoom = null; rooms = new List<Room>(); break; case GenerationStep.TargetGeneration: if (!GenerateTarget()) { Step = GenerationStep.Initialize; return; } break; case GenerationStep.SpecialGeneration: GenerateSpecials(); break; case GenerationStep.BranchGeneration: GenerateBranches(); break; } Step++; }
public Generator(int seed, DungeonTemplate template) { rand = new Random(seed); this.template = template; Step = GenerationStep.Initialize; }
public static List <GenerationStep> AllLessThanOrEqualThis(this GenerationStep stepEnum) { return(Enum.GetValues(typeof(GenerationStep)).Cast <GenerationStep>().Where(it => it <= stepEnum).ToList()); }