We will develop three different classes: a component for our prefabs, the level predictor, and the level generator that puts everything together.
LevelSlice is the component to attach to the prefabs:
using UnityEngine;public class LevelSlice : MonoBehaviour{ public string id; override public string ToString() { return id; }}
Now we need to develop the predictor:
public class LevelPredictor : NGramPredictor<LevelSlice>{ public LevelPredictor(int windowSize) : base(windowSize) { }}
And, finally, we develop the level generator:
using UnityEngine;using System.Collections.Generic;public class LevelGenerator : MonoBehaviour{ public LevelPredictor predictor; public List<LevelSlice> pattern; public List<LevelSlice> result; private ...