BuilderInstruction getRndInstruction(BuilderInstruction previous) { foreach (var key in linkOptions.Keys) { if (key.equals(previous)) { var options = linkOptions[key]; return(options[Random.Range(0, options.Count)]); } } throw new System.Exception("Could not find instruction"); }
void BuildFistula() { var seg = SpawnSegment(firstSegment, transform.position, firstSegmentFlipped); var instruction = new BuilderInstruction(seg); for (int i = 1; i < segmentsDeep; i++) { instruction = getRndInstruction(instruction); seg = SpawnSegment(instruction.segment, seg.Bottom, instruction.flipped); seg.SpawnDirt(1); } bottom.transform.position = seg.Bottom; }
public bool equals(BuilderInstruction other) => other.segment.SegmentID == segment.SegmentID && other.flipped == flipped;