publicstringlevelName;// Name of the level in the Resources/Levels folder
// There should be a .png for the tile map of the level and a text file detailing which prefabs
// correlate to which RGB value
// The text file lists the path of the prefab to be used and the RGB value assigned to that prefab
publicMaterialmat;
privateGameObjecttilesParent;
privateboolupdated=false;
voidStart()
{
create();
}
voidUpdate()
{
if(!updated)
setMaterials();
}
publicvoidcreate()
{
clear();
Vector3scale=transform.localScale;// Store scale to rescale when finished creating map
transform.localScale=Vector3.one;// Set scale to 1 so new objects get scaled down
Texture2Dlevel=pathToTex(levelName);// Image of level
Color32[]pixels=level.GetPixels32();// Pixels of the image
World.setup(level.width,level.height);
Dictionary<byte,Dictionary<byte,Dictionary<byte,GameObject[]>>>rgbDic=newDictionary<byte,Dictionary<byte,Dictionary<byte,GameObject[]>>>();// RGB mapping of prefabs
Dictionary<byte,GameObject>aDic=newDictionary<byte,GameObject>();// Alpha mapping of prefabs