Exemplo n.º 1
0
 public static bool ReadPixel2U3DNumber(TValue v, out float value)
 {
     value = 0.0f;
     System.Int32 temp = 0;
     if (!LuaDataReadHelper.ReadNumber(v, out temp))
     {
         return(false);
     }
     value = SharedGlobalParams.PixelUnit2U3D(temp);
     return(true);
 }
Exemplo n.º 2
0
        public static bool ReadPixel2U3DVector3(TValue v, out UnityEngine.Vector3 value)
        {
            value = UnityEngine.Vector3.zero;
            float[] number = null;

            string numStr = ReadUtf8String(v);
            string sp     = ",";

            string[] numStrs = numStr.Split(sp.ToCharArray());
            if (numStrs.Length == 3)
            {
                number = new float[3];
                if (!float.TryParse(numStrs[0], out number[0]))
                {
                    return(false);
                }
                if (!float.TryParse(numStrs[1], out number[1]))
                {
                    return(false);
                }
                if (!float.TryParse(numStrs[2], out number[2]))
                {
                    return(false);
                }
            }
            else
            {
                number = ReadNumberArray(v, out number);
                if (number.Length != 3)
                {
                    return(false);
                }
            }
            value = new UnityEngine.Vector3(SharedGlobalParams.PixelUnit2U3D(number[0]),
                                            SharedGlobalParams.PixelUnit2U3D(number[1]),
                                            SharedGlobalParams.PixelUnit2U3D(number[2]));
            return(true);
        }