protected void Load() { if (curves == null) { string curveDataPath_File = CurveDataPath_File(mat); if (File.Exists(curveDataPath_File)) { string str = File.ReadAllText(curveDataPath_File); curves = JsonUtility.FromJson <MatCurves> (str); } else { Init(); } } }
void Init() { curves = new MatCurves(); for (int i = 0; i < 4; i++) { var cr = new AnimationCurve(); curves.curves [i] = cr; if (i < 3) { cr.AddKey(new Keyframe(0f, 0.5f)); cr.AddKey(new Keyframe(0.25f, 1f)); cr.AddKey(new Keyframe(0.75f, 0f)); cr.AddKey(new Keyframe(1f, 0.5f)); } else { cr.AddKey(new Keyframe(0f, 1f)); cr.AddKey(new Keyframe(1f, 1f)); } } }