public void Deserialize(XElement xml) { shader = xml.Element("shader").Attribute("value").Value; color.r = FloatParser.stof(xml.Element("colorR").Attribute("value").Value); color.g = FloatParser.stof(xml.Element("colorG").Attribute("value").Value); color.b = FloatParser.stof(xml.Element("colorB").Attribute("value").Value); color.a = 1.0f; texture = xml.Element("texture").Attribute("value").Value; }
public void Deserialize(XElement xml) { if (points == null) { points = new Dictionary <float, float>(); } points.Clear(); foreach (XElement elem in xml.Elements()) { float x = FloatParser.stof(elem.Attribute("x").Value); float y = FloatParser.stof(elem.Attribute("y").Value); points.Add(x, y); } }
public void Deserialize(XElement xml) { for (int i = 0; i < 6; i++) { animCurves[i] = new AnimationCurve(); animCurves[i].postWrapMode = WrapMode.Loop; } foreach (XElement x in xml.Elements("key")) { animCurves[0].AddKey(FloatParser.stof(x.Attribute("t").Value), FloatParser.stof(x.Attribute("px").Value)); animCurves[1].AddKey(FloatParser.stof(x.Attribute("t").Value), FloatParser.stof(x.Attribute("py").Value)); animCurves[2].AddKey(FloatParser.stof(x.Attribute("t").Value), FloatParser.stof(x.Attribute("pz").Value)); animCurves[3].AddKey(FloatParser.stof(x.Attribute("t").Value), FloatParser.stof(x.Attribute("rx").Value)); animCurves[4].AddKey(FloatParser.stof(x.Attribute("t").Value), FloatParser.stof(x.Attribute("ry").Value)); animCurves[5].AddKey(FloatParser.stof(x.Attribute("t").Value), FloatParser.stof(x.Attribute("rz").Value)); } }
private float ReadValue(XElement xml, string name) { XElement value = xml.Element(name); if (value == null) { Debug.LogError("couldn't find '" + name + "' in quad config"); return(0.0f); } else { try { return(FloatParser.stof(value.Attribute("value").Value)); } catch (FormatException) { Debug.LogError("couldn't parse '" + name + "' in quad config"); return(0.0f); } } }
private Quaternion StrQuat(string str) { string[] split = str.Split(','); if (split.Length != 4) { Debug.LogError("LevelElement.StrQuat value count: '" + str + "'"); return(Quaternion.identity); } Quaternion quat = Quaternion.identity; for (int i = 0; i < split.Length; i++) { try { quat[i] = FloatParser.stof(split[i]); } catch (FormatException) { Debug.LogError("LevelElement.StrQuat just received proper bullshit: '" + str + "'"); return(quat); } } return(quat); }
private Vector3 StrVec(string str) { string[] split = str.Split(','); if (split.Length < 2 || split.Length > 3) { Debug.LogError("LevelElement.StrVec value count: '" + str + "'"); return(Vector3.zero); } Vector3 vec = Vector3.zero; for (int i = 0; i < split.Length; i++) { try { vec[i] = FloatParser.stof(split[i]); } catch (FormatException) { Debug.LogError("LevelElement.StrVec just received proper bullshit: '" + str + "'"); return(vec); } } return(vec); }
private float ReadValue(XElement xml, string name) { return(FloatParser.stof(xml.Element(name).Attribute("value").Value)); }