5 namespace HKI.Core.Variables
15 [CreateAssetMenu(fileName =
"IntegerMinMax", menuName =
"HKI/Variables/Integer Min-Max", order = 7)]
19 public override void Save(XmlNode parentNode)
21 XmlNode node = parentNode.OwnerDocument.CreateElement(name.Replace(
" ",
""));
22 parentNode.AppendChild(node);
24 XmlAttribute valueAttribute = parentNode.OwnerDocument.CreateAttribute(
"Value");
25 valueAttribute.Value = Value.ToString();
26 node.Attributes.Append(valueAttribute);
29 public override void Load(XmlNode node)
31 if (node.Attributes == null)
33 Debug.LogError(
"(IntegerMinMax) >" + name +
"< Loading failed because this XmlNode has not attributes!");
37 XmlAttribute valueAttribute = node.Attributes[
"Value"];
38 if (valueAttribute == null)
40 Debug.LogError(
"(IntegerMinMax) >" + name +
"< Loading failed because this XmlNode has not an attribute with the name >Value<!");
45 if (
int.TryParse(valueAttribute.Value, out parsedValue))
46 SetValue = parsedValue;
48 Debug.LogError(
"(IntegerMinMax) >" + name +
"< Loading failed because parsing of >" + valueAttribute.Value +
"< failed!");
This class extens HKIVarGeneric with a min and a max value.
Implementation of a min max integer value as a HKIVar via HKIVarGenericMinMax.
override void Load(XmlNode node)
override void Save(XmlNode parentNode)