private static bool setInitialValueForProperty(JSONInit init, object value)
 {
     if (init.go == null || value == null || init.strings == null || init.strings.Length < 2 || init.typeExtra == null)
     {
         return(false);
     }
     if (init.typeExtra == "fieldInfo")
     {
         getFieldInfo(init.go, init.strings[0], init.strings[1]).SetValue(getCMP(init.go, init.strings[0]), value);
     }
     else
     {
         getPropertyInfo(init.go, init.strings[0], init.strings[1]).SetValue(getCMP(init.go, init.strings[0]), value, null);
     }
     return(true);
 }
        private static bool setInitialValue(JSONInit init)
        {
            switch (init.type)
            {
            case "position":
                if (init.position == null || init.go == null)
                {
                    return(false);
                }
                getGO(init.go).transform.position = init.position.toVector3();
                break;

            case "rotation":
                if (init.rotation == null || init.go == null)
                {
                    return(false);
                }
                getGO(init.go).transform.rotation = init.rotation.toQuaternion();
                break;

            case "orientation":
                // track4OBJ.transform.LookAt (new Vector3(0f, 1f, -5f)); // Set Initial Orientation
                if (init.position == null || init.go == null)
                {
                    return(false);
                }
                getGO(init.go).transform.LookAt(init.position.toVector3());
                break;

            case "propertyint":
                if (!setInitialValueForProperty(init, init._int))
                {
                    return(false);
                }
                break;

            case "propertylong":
                if (!setInitialValueForProperty(init, init._long))
                {
                    return(false);
                }
                break;

            case "propertyfloat":
                if (init.floats == null || init.floats.Length <= 0)
                {
                    return(false);
                }
                if (!setInitialValueForProperty(init, init.floats[0]))
                {
                    return(false);
                }
                break;

            case "propertydouble":
                if (!setInitialValueForProperty(init, init._double))
                {
                    return(false);
                }
                break;

            case "propertyvect2":
                if (init._vect2 == null)
                {
                    return(false);
                }
                if (!setInitialValueForProperty(init, init._vect2.toVector2()))
                {
                    return(false);
                }
                break;

            case "propertyvect3":
                if (init.position == null)
                {
                    return(false);
                }
                if (!setInitialValueForProperty(init, init.position.toVector3()))
                {
                    return(false);
                }
                break;

            case "propertycolor":
                if (init._color == null)
                {
                    return(false);
                }
                if (!setInitialValueForProperty(init, init._color.toColor()))
                {
                    return(false);
                }
                break;

            case "propertyrect":
                if (init._rect == null)
                {
                    return(false);
                }
                if (!setInitialValueForProperty(init, init._rect.toRect()))
                {
                    return(false);
                }
                break;

            default:
                Debug.LogWarning("Animator: Error parsing initial value type '" + init.type + "'");
                return(false);
            }
            return(true);
        }
    private static bool setInitialValue(JSONInit init)
    {
        switch (init.type)
        {
        case "position":
            if (init.position == null || init.go == null)
            {
                return(false);
            }
            getGO(init.go).transform.position = init.position.toVector3();
            break;

        case "rotation":
            if (init.rotation == null || init.go == null)
            {
                return(false);
            }
            getGO(init.go).transform.rotation = init.rotation.toQuaternion();
            break;

        case "orientation":
            // track4OBJ.transform.LookAt (new Vector3(0f, 1f, -5f)); // Set Initial Orientation
            if (init.position == null || init.go == null)
            {
                return(false);
            }
            getGO(init.go).transform.LookAt(init.position.toVector3());
            break;

        case "propertymorph":
            if (init.go == null || init.floats == null)
            {
                return(false);
            }
            AMTween.SetMorph(getCMP(init.go, "MegaMorph"), getMethodInfo(init.go, "MegaMorph", "SetPercent", new string[] { "System.Int32", "System.Single" }), init.floats);
            break;

        case "propertyint":
            if (!setInitialValueForProperty(init, init._int))
            {
                return(false);
            }
            break;

        case "propertylong":
            if (!setInitialValueForProperty(init, init._long))
            {
                return(false);
            }
            break;

        case "propertyfloat":
            if (init.floats == null || init.floats.Length <= 0)
            {
                return(false);
            }
            if (!setInitialValueForProperty(init, init.floats[0]))
            {
                return(false);
            }
            break;

        case "propertydouble":
            if (!setInitialValueForProperty(init, init._double))
            {
                return(false);
            }
            break;

        case "propertyvect2":
            if (init._vect2 == null)
            {
                return(false);
            }
            if (!setInitialValueForProperty(init, init._vect2.toVector2()))
            {
                return(false);
            }
            break;

        case "propertyvect3":
            if (init.position == null)
            {
                return(false);
            }
            if (!setInitialValueForProperty(init, init.position.toVector3()))
            {
                return(false);
            }
            break;

        case "propertycolor":
            if (init._color == null)
            {
                return(false);
            }
            if (!setInitialValueForProperty(init, init._color.toColor()))
            {
                return(false);
            }
            break;

        case "propertyrect":
            if (init._rect == null)
            {
                return(false);
            }
            if (!setInitialValueForProperty(init, init._rect.toRect()))
            {
                return(false);
            }
            break;

        case "cameraswitcher":
            // setup all cameras
            if (init.strings != null && init.strings.Length > 0)
            {
                allCameras = new Camera[init.strings.Length];
                for (int i = 0; i < init.strings.Length; i++)
                {
                    allCameras[i] = getGO(init.strings[i]).GetComponent <Camera>();
                }
            }
            // setup all textures

            /*if(init.stringsExtra != null && init.stringsExtra.Length > 0) {
             *      allTextures = new Texture[init.stringsExtra.Length];
             *      for(int i=0;i<init.stringsExtra.Length;i++) {
             *              allTextures[i] = AMTween.LoadTexture2D(init.stringsExtra[i]);
             *      }
             * }*/
            // set top camera
            if (init.typeExtra == "camera")
            {
                if (init.go == null)
                {
                    return(false);
                }
                AMTween.SetTopCamera(getGO(init.go).GetComponent <Camera>(), allCameras);
            }
            else
            {
                if (init._color == null)
                {
                    return(false);
                }
                AMTween.ShowColor(init._color.toColor());
            }
            break;

        default:
            Debug.LogWarning("Animator: Error parsing initial value type '" + init.type + "'");
            return(false);
        }
        return(true);
    }
 private static bool setInitialValueForProperty(JSONInit init, object value)
 {
     if(init.go == null || value == null || init.strings == null || init.strings.Length < 2 || init.typeExtra == null) return false;
     if(init.typeExtra == "fieldInfo") getFieldInfo(init.go, init.strings[0],init.strings[1]).SetValue(getCMP(init.go,init.strings[0]),value);
     else getPropertyInfo(init.go, init.strings[0],init.strings[1]).SetValue(getCMP(init.go,init.strings[0]),value,null);
     return true;
 }
 private static bool setInitialValue(JSONInit init)
 {
     switch(init.type) {
     case "position":
         if(init.position == null || init.go == null) return false;
         getGO(init.go).transform.position = init.position.toVector3();
         break;
     case "rotation":
         if(init.rotation == null || init.go == null) return false;
         getGO(init.go).transform.rotation = init.rotation.toQuaternion();
         break;
     case "orientation":
         // track4OBJ.transform.LookAt (new Vector3(0f, 1f, -5f)); // Set Initial Orientation
         if(init.position == null || init.go == null) return false;
         getGO(init.go).transform.LookAt(init.position.toVector3());
         break;
     case "propertyint":
         if(!setInitialValueForProperty(init,init._int)) return false;
         break;
     case "propertylong":
         if(!setInitialValueForProperty(init,init._long)) return false;
         break;
     case "propertyfloat":
         if(init.floats == null || init.floats.Length <= 0) return false;
         if(!setInitialValueForProperty(init,init.floats[0])) return false;
         break;
     case "propertydouble":
         if(!setInitialValueForProperty(init,init._double)) return false;
         break;
     case "propertyvect2":
         if(init._vect2 == null) return false;
         if(!setInitialValueForProperty(init,init._vect2.toVector2())) return false;
         break;
     case "propertyvect3":
         if(init.position == null) return false;
         if(!setInitialValueForProperty(init,init.position.toVector3())) return false;
         break;
     case "propertycolor":
         if(init._color == null) return false;
         if(!setInitialValueForProperty(init,init._color.toColor())) return false;
         break;
     case "propertyrect":
         if(init._rect == null) return false;
         if(!setInitialValueForProperty(init,init._rect.toRect())) return false;
         break;
     default:
         Debug.LogWarning("Animator: Error parsing initial value type '"+init.type+"'");
         return false;
     }
     return true;
 }
 private static bool setInitialValue(JSONInit init)
 {
     switch(init.type) {
     case "position":
         if(init.position == null || init.go == null) return false;
         getGO(init.go).transform.position = init.position.toVector3();
         break;
     case "rotation":
         if(init.rotation == null || init.go == null) return false;
         getGO(init.go).transform.rotation = init.rotation.toQuaternion();
         break;
     case "orientation":
         // track4OBJ.transform.LookAt (new Vector3(0f, 1f, -5f)); // Set Initial Orientation
         if(init.position == null || init.go == null) return false;
         getGO(init.go).transform.LookAt(init.position.toVector3());
         break;
     case "propertymorph":
         if(init.go == null || init.floats == null) return false;
         AMTween.SetMorph(getCMP(init.go, "MegaMorph"), getMethodInfo(init.go,"MegaMorph","SetPercent",new string[]{"System.Int32","System.Single"}), init.floats);
         break;
     case "propertyint":
         if(!setInitialValueForProperty(init,init._int)) return false;
         break;
     case "propertylong":
         if(!setInitialValueForProperty(init,init._long)) return false;
         break;
     case "propertyfloat":
         if(init.floats == null || init.floats.Length <= 0) return false;
         if(!setInitialValueForProperty(init,init.floats[0])) return false;
         break;
     case "propertydouble":
         if(!setInitialValueForProperty(init,init._double)) return false;
         break;
     case "propertyvect2":
         if(init._vect2 == null) return false;
         if(!setInitialValueForProperty(init,init._vect2.toVector2())) return false;
         break;
     case "propertyvect3":
         if(init.position == null) return false;
         if(!setInitialValueForProperty(init,init.position.toVector3())) return false;
         break;
     case "propertycolor":
         if(init._color == null) return false;
         if(!setInitialValueForProperty(init,init._color.toColor())) return false;
         break;
     case "propertyrect":
         if(init._rect == null) return false;
         if(!setInitialValueForProperty(init,init._rect.toRect())) return false;
         break;
     case "cameraswitcher":
         // setup all cameras
         if(init.strings != null && init.strings.Length > 0) {
             allCameras = new Camera[init.strings.Length];
             for(int i=0;i<init.strings.Length;i++) {
                 allCameras[i] = getGO(init.strings[i]).camera;
             }
         }
         // setup all textures
         /*if(init.stringsExtra != null && init.stringsExtra.Length > 0) {
             allTextures = new Texture[init.stringsExtra.Length];
             for(int i=0;i<init.stringsExtra.Length;i++) {
                 allTextures[i] = AMTween.LoadTexture2D(init.stringsExtra[i]);
             }
         }*/
         // set top camera
         if(init.typeExtra == "camera") {
             if(init.go == null) return false;
             AMTween.SetTopCamera(getGO(init.go).camera,allCameras);
         } else {
             if(init._color == null) return false;
             AMTween.ShowColor(init._color.toColor());
         }
         break;
     default:
         Debug.LogWarning("Animator: Error parsing initial value type '"+init.type+"'");
         return false;
     }
     return true;
 }