/// <summary> /// Creates a TerrainMaterial from a JSON object. Does NOT recreate mesh data automatically or link materials! /// </summary> /// <param name="aJSON">A parsed JSON value containing PathTerrain and Path data</param> public void FromJSON(Ferr_JSONValue aJSON) { fill = (Ferr2DT_FillMode)Enum.Parse(typeof(Ferr2DT_FillMode), aJSON["fill", "Closed"]); fillY = aJSON["fillY", 0]; fillZ = aJSON["fillZ", 0.2f]; splitCorners = aJSON["splitCorners", true]; smoothPath = aJSON["smoothPath", false]; splitDist = aJSON["splitDist", 4]; pixelsPerUnit = aJSON["pixelsPerUnit", 32]; stretchThreshold = aJSON["stretchThreshold", 0.5f]; vertexColor = Ferr_Color.FromHex(aJSON["vertexColor", "FFFFFF"]); createCollider = aJSON["createCollider", true]; create3DCollider = aJSON["create3DCollider", false]; depth = aJSON["depth", 4]; surfaceOffset[0] = aJSON["surfaceOffset.0", 0]; surfaceOffset[1] = aJSON["surfaceOffset.1", 0]; surfaceOffset[2] = aJSON["surfaceOffset.2", 0]; surfaceOffset[3] = aJSON["surfaceOffset.3", 0]; collidersBottom = aJSON["colliders.bottom", true]; collidersTop = aJSON["colliders.top", true]; collidersLeft = aJSON["colliders.left", true]; collidersRight = aJSON["colliders.right", true]; Ferr_JSONValue overrides = aJSON["directionOverrides"]; for (int i = 0; i < overrides.Length; i++) { directionOverrides.Add((Ferr2DT_TerrainDirection)Enum.Parse(typeof(Ferr2DT_TerrainDirection), overrides[i, "None"])); } path.FromJSON(aJSON["path"]); }
/// <summary> /// Creates a TerrainMaterial from a JSON object. Does NOT recreate mesh data automatically or link materials! /// </summary> /// <param name="aJSON">A parsed JSON value containing PathTerrain and Path data</param> public void FromJSON(Ferr_JSONValue aJSON) { fill = (Ferr2DT_FillMode)Enum.Parse(typeof(Ferr2DT_FillMode), aJSON["fill", "Closed"]); fillY = aJSON["fillY", 0]; fillZ = aJSON["fillZ", 0.2f]; splitCorners = aJSON["splitCorners", true]; smoothPath = aJSON["smoothPath", false]; splitCount = (int)aJSON["splitCount", 4]; splitDist = aJSON["splitDist", 1]; splitMiddle = aJSON["splitMiddle", true]; pixelsPerUnit = aJSON["pixelsPerUnit", 32]; stretchThreshold = aJSON["stretchThreshold", 0.5f]; vertexColor = Ferr_Color.FromHex(aJSON["vertexColor", "FFFFFF"]); createTangents = aJSON["createTangents", false]; createCollider = aJSON["createCollider", true]; create3DCollider = aJSON["create3DCollider", false]; depth = aJSON["depth", 4]; isTrigger = aJSON["isTrigger", false]; sharpCorners = aJSON["sharpCorners", false]; sharpCornerDistance = aJSON["sharpCornerDist", 2]; smoothSphereCollisions = aJSON["ssCollisions", false]; randomByWorldCoordinates = aJSON["randomBWC", false]; slantAmount = aJSON["slantAmount", 0]; uvOffset.x = aJSON["uvOffset.x", 0]; uvOffset.y = aJSON["uvOffset.y", 0]; surfaceOffset[0] = aJSON["surfaceOffset.0", 0]; surfaceOffset[1] = aJSON["surfaceOffset.1", 0]; surfaceOffset[2] = aJSON["surfaceOffset.2", 0]; surfaceOffset[3] = aJSON["surfaceOffset.3", 0]; collidersBottom = aJSON["colliders.bottom", true]; collidersTop = aJSON["colliders.top", true]; collidersLeft = aJSON["colliders.left", true]; collidersRight = aJSON["colliders.right", true]; Ferr_JSONValue overrides = aJSON["directionOverrides"]; for (int i = 0; i < overrides.Length; i++) { directionOverrides.Add((Ferr2DT_TerrainDirection)Enum.Parse(typeof(Ferr2DT_TerrainDirection), overrides[i, "None"])); vertScales.Add(1); } Path.FromJSON(aJSON["path"]); }
/// <summary> /// Creates a TerrainMaterial from a JSON object. Does NOT recreate mesh data automatically or link materials! /// </summary> /// <param name="aJSON">A parsed JSON value containing PathTerrain and Path data</param> public void FromJSON(Ferr_JSONValue aJSON) { fill = (Ferr2DT_FillMode)Enum.Parse(typeof(Ferr2DT_FillMode), aJSON["fill", "Closed"]); fillY = aJSON["fillY", 0]; fillZ = aJSON["fillZ", 0.2f]; splitCorners = aJSON["splitCorners", true]; smoothPath = aJSON["smoothPath", false]; splitCount = (int)aJSON["splitCount", 4]; splitDist = aJSON["splitDist", 1]; splitMiddle = aJSON["splitMiddle", true]; pixelsPerUnit = aJSON["pixelsPerUnit", 32]; stretchThreshold = aJSON["stretchThreshold", 0.5f]; vertexColor = Ferr_Color.FromHex(aJSON["vertexColor", "FFFFFF"]); createTangents = aJSON["createTangents", false]; createCollider = aJSON["createCollider", true]; create3DCollider = aJSON["create3DCollider", false]; depth = aJSON["depth", 4]; isTrigger = aJSON["isTrigger", false]; sharpCorners = aJSON["sharpCorners", false]; sharpCornerDistance = aJSON["sharpCornerDist", 2]; smoothSphereCollisions = aJSON["ssCollisions", false]; randomByWorldCoordinates = aJSON["randomBWC", false]; slantAmount = aJSON["slantAmount", 0]; uvOffset.x = aJSON["uvOffset.x", 0]; uvOffset.y = aJSON["uvOffset.y", 0]; surfaceOffset[0] = aJSON["surfaceOffset.0", 0]; surfaceOffset[1] = aJSON["surfaceOffset.1", 0]; surfaceOffset[2] = aJSON["surfaceOffset.2", 0]; surfaceOffset[3] = aJSON["surfaceOffset.3", 0]; collidersBottom = aJSON["colliders.bottom", true]; collidersTop = aJSON["colliders.top", true]; collidersLeft = aJSON["colliders.left", true]; collidersRight = aJSON["colliders.right", true]; Ferr_JSONValue overrides = aJSON["directionOverrides"]; for (int i = 0; i < overrides.Length; i++) { directionOverrides.Add ( (Ferr2DT_TerrainDirection)Enum.Parse(typeof(Ferr2DT_TerrainDirection), overrides[i,"None"]) ); vertScales.Add(1); } Path.FromJSON (aJSON["path"]); }