Пример #1
0
 public AttachNodeBaseData(String nodeData)
 {
     String[] dataVals = nodeData.Split(new String[] { "," }, StringSplitOptions.None);
     position    = new Vector3(ROTUtils.safeParseFloat(dataVals[0].Trim()), ROTUtils.safeParseFloat(dataVals[1].Trim()), ROTUtils.safeParseFloat(dataVals[2].Trim()));
     orientation = new Vector3(ROTUtils.safeParseFloat(dataVals[3].Trim()), ROTUtils.safeParseFloat(dataVals[4].Trim()), ROTUtils.safeParseFloat(dataVals[5].Trim()));
     size        = dataVals.Length > 6 ? ROTUtils.safeParseInt(dataVals[6]) : 4;
 }
Пример #2
0
 public void loadPersistence(String data)
 {
     String[] csv = ROTUtils.parseCSV(data);
     topY         = ROTUtils.safeParseFloat(csv[0]);
     bottomY      = ROTUtils.safeParseFloat(csv[1]);
     topRadius    = ROTUtils.safeParseFloat(csv[2]);
     bottomRadius = ROTUtils.safeParseFloat(csv[3]);
 }
Пример #3
0
        public static float[] GetFloatValues(this ConfigNode node, String name, float[] defaults)
        {
            String baseVal = node.GetStringValue(name);

            if (!String.IsNullOrEmpty(baseVal))
            {
                String[] split = baseVal.Split(new char[] { ',' });
                float[]  vals  = new float[split.Length];
                for (int i = 0; i < split.Length; i++)
                {
                    vals[i] = ROTUtils.safeParseFloat(split[i]);
                }
                return(vals);
            }
            return(defaults);
        }
Пример #4
0
        public static FloatCurve GetFloatCurve(this ConfigNode node, String name, FloatCurve defaultValue = null)
        {
            FloatCurve curve = new FloatCurve();

            if (node.HasNode(name))
            {
                ConfigNode curveNode = node.GetNode(name);
                String[]   values    = curveNode.GetValues("key");
                int        len       = values.Length;
                String[]   splitValue;
                float      a, b, c, d;
                for (int i = 0; i < len; i++)
                {
                    splitValue = Regex.Replace(values[i], @"\s+", " ").Split(' ');
                    if (splitValue.Length > 2)
                    {
                        a = ROTUtils.safeParseFloat(splitValue[0]);
                        b = ROTUtils.safeParseFloat(splitValue[1]);
                        c = ROTUtils.safeParseFloat(splitValue[2]);
                        d = ROTUtils.safeParseFloat(splitValue[3]);
                        curve.Add(a, b, c, d);
                    }
                    else
                    {
                        a = ROTUtils.safeParseFloat(splitValue[0]);
                        b = ROTUtils.safeParseFloat(splitValue[1]);
                        curve.Add(a, b);
                    }
                }
            }
            else if (defaultValue != null)
            {
                foreach (Keyframe f in defaultValue.Curve.keys)
                {
                    curve.Add(f.time, f.value, f.inTangent, f.outTangent);
                }
            }
            else
            {
                curve.Add(0, 0);
                curve.Add(1, 1);
            }
            return(curve);
        }