Exemplo n.º 1
0
        void Start()
        {
            activeList = new bool[theStructs.Count];

            for (int i = 0; i < theStructs.Count; i++)
            {
                tempStruct = theStructs[i];

                tempStruct.RealComponent = tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent);

                if (tempStruct.valueType == ValType.Field)
                {
                    tempStruct.realField = tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent).GetType().GetField(tempStruct.targetVariable);
                }

                if (tempStruct.valueType == ValType.Property)
                {
                    tempStruct.realProperty = tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent).GetType().GetProperty(tempStruct.targetVariable);
                }



                if (tempStruct.methodOnEnd)
                {
                    tempStruct.methodRealComponent = tempStruct.methodTargetGameObject.GetComponent(tempStruct.methodTargetComponent);
                    tempStruct.methodRealMethod    = tempStruct.methodTargetGameObject.GetComponent(tempStruct.methodTargetComponent).GetType().GetMethod(tempStruct.methodTargetMethod);
                }

                theStructs[i] = tempStruct;
            }
        }
Exemplo n.º 2
0
		void Start ()
		{
			activeList = new bool[theStructs.Count];

			for (int i = 0; i < theStructs.Count; i++)
			{
				tempStruct = theStructs[i];

				tempStruct.RealComponent = tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent);

				if (tempStruct.valueType == ValType.Field)
					tempStruct.realField = tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent).GetType().GetField(tempStruct.targetVariable);
				
				if (tempStruct.valueType == ValType.Property)
					tempStruct.realProperty = tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent).GetType().GetProperty(tempStruct.targetVariable);

				

				if (tempStruct.methodOnEnd)
				{
					tempStruct.methodRealComponent = tempStruct.methodTargetGameObject.GetComponent(tempStruct.methodTargetComponent);
					tempStruct.methodRealMethod = tempStruct.methodTargetGameObject.GetComponent(tempStruct.methodTargetComponent).GetType().GetMethod(tempStruct.methodTargetMethod);
				}
					
				theStructs[i] = tempStruct;
			}
		}
Exemplo n.º 3
0
		void Awake()
		{
			scriptTarget = (EZAnim)target;
			if (scriptTarget.theStructs == null)
			{
				scriptTarget.theStructs = new List<EZStruct>();
				scriptTarget.theStructs.Add(new EZStruct());

				tempStruct = scriptTarget.theStructs[0];
				tempStruct.animationType = AnimType.EaseOutQuint;
				tempStruct.animationDuration = 1f;
				scriptTarget.theStructs[0] = tempStruct;
			}
			inclusions = new string[] {"System.Single", "System.Int32", "UnityEngine.Vector2", "UnityEngine.Vector3", "UnityEngine.Rect", "UnityEngine.Color", "UnityEngine.Material"};
			inclusionNames = new string[] {"Float", "Int", "Vector2", "Vector3", "Rect", "Color", "Material"};
			methodNameExclusions = new string[] { "Update", "FixedUpdate", "LateUpdate", "Start", "Awake", "OnEnable", "OnDisable" };
		}
Exemplo n.º 4
0
        void Awake()
        {
            scriptTarget = (EZAnim)target;
            if (scriptTarget.theStructs == null)
            {
                scriptTarget.theStructs = new List <EZStruct>();
                scriptTarget.theStructs.Add(new EZStruct());

                tempStruct = scriptTarget.theStructs[0];
                tempStruct.animationType     = AnimType.EaseOutQuint;
                tempStruct.animationDuration = 1f;
                scriptTarget.theStructs[0]   = tempStruct;
            }
            inclusions           = new string[] { "System.Single", "System.Int32", "UnityEngine.Vector2", "UnityEngine.Vector3", "UnityEngine.Rect", "UnityEngine.Color", "UnityEngine.Material" };
            inclusionNames       = new string[] { "Float", "Int", "Vector2", "Vector3", "Rect", "Color", "Material" };
            methodNameExclusions = new string[] { "Update", "FixedUpdate", "LateUpdate", "Start", "Awake", "OnEnable", "OnDisable" };
        }
Exemplo n.º 5
0
        private void AnimStruct(int i)
        {
            activeList[i] = true;
            tempStruct = theStructs[i];

            tempStruct.animStartTime = Time.realtimeSinceStartup + tempStruct.delay;

            if (tempStruct.variableType == "System.Single")
            {
                if (tempStruct.valueType == ValType.Field)
                    tempStruct.initialFloat = (float)tempStruct.realField.GetValue(tempStruct.RealComponent);
                else if (tempStruct.valueType == ValType.Property)
                    tempStruct.initialFloat = (float)tempStruct.realProperty.GetValue(tempStruct.RealComponent, null);
            }
            else if (tempStruct.variableType == "System.Int32")
            {
                if (tempStruct.valueType == ValType.Field)
                    tempStruct.initialInt = (int)tempStruct.realField.GetValue(tempStruct.RealComponent);
                else if (tempStruct.valueType == ValType.Property)
                    tempStruct.initialInt = (int)tempStruct.realProperty.GetValue(tempStruct.RealComponent, null);
            }
            else if (tempStruct.variableType == "UnityEngine.Vector2")
            {
                if (tempStruct.valueType == ValType.Field)
                    tempStruct.initialVector2 = (Vector2)tempStruct.realField.GetValue(tempStruct.RealComponent);
                else if (tempStruct.valueType == ValType.Property)
                    tempStruct.initialVector2 = (Vector2)tempStruct.realProperty.GetValue(tempStruct.RealComponent, null);
            }
            else if (tempStruct.variableType == "UnityEngine.Vector3")
            {
                if (tempStruct.valueType == ValType.Field)
                    tempStruct.initialVector3 = (Vector3)tempStruct.realField.GetValue(tempStruct.RealComponent);
                else if (tempStruct.valueType == ValType.Property)
                    tempStruct.initialVector3 = (Vector3)tempStruct.realProperty.GetValue(tempStruct.RealComponent, null);
            }
            else if (tempStruct.variableType == "UnityEngine.Rect")
            {
                if (tempStruct.valueType == ValType.Field)
                    tempStruct.initialRect = (Rect)tempStruct.realField.GetValue(tempStruct.RealComponent);
                else if (tempStruct.valueType == ValType.Property)
                    tempStruct.initialRect = (Rect)tempStruct.realProperty.GetValue(tempStruct.RealComponent, null);
            }
            else if (tempStruct.variableType == "UnityEngine.Color")
            {
                if (tempStruct.valueType == ValType.Field)
                    tempStruct.initialColor = (Color)tempStruct.realField.GetValue(tempStruct.RealComponent);
                else if (tempStruct.valueType == ValType.Property)
                    tempStruct.initialColor = (Color)tempStruct.realProperty.GetValue(tempStruct.RealComponent, null);
            }
            else if (tempStruct.variableType == "UnityEngine.Material")
            {
                if (tempStruct.valueType == ValType.Field)
                    tempStruct.initialMaterial = (Material)tempStruct.realField.GetValue(tempStruct.RealComponent);
                else if (tempStruct.valueType == ValType.Property)
                    tempStruct.initialMaterial = (Material)tempStruct.realProperty.GetValue(tempStruct.RealComponent, null);
            }

            tempStruct.called = false;

            theStructs[i] = tempStruct;
        }
Exemplo n.º 6
0
        void Update()
        {
            for (int i = 0; i < theStructs.Count; i++)
            {
                if (activeList[i] == true)
                {
                    tempStruct = theStructs[i];

                    tempStruct.animDeltaTime = Time.realtimeSinceStartup - tempStruct.animStartTime;

                    if (tempStruct.animDeltaTime < tempStruct.animationDuration)
                    {
                        if (tempStruct.variableType == "System.Single")
                        {
                            tempFloat = UpdateAnimation(tempStruct.initialFloat, tempStruct.targetFloat, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.valueType == ValType.Field)
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempFloat);
                            else if (tempStruct.valueType == ValType.Property)
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempFloat, null);
                        }
                        else if (tempStruct.variableType == "System.Int32")
                        {
                            tempFloat = UpdateAnimation(tempStruct.initialInt, tempStruct.targetInt, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.valueType == ValType.Field)
                                tempStruct.realField.SetValue(tempStruct.RealComponent, Mathf.RoundToInt(tempFloat));
                            else if (tempStruct.valueType == ValType.Property)
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, Mathf.RoundToInt(tempFloat), null);
                        }
                        else if (tempStruct.variableType == "UnityEngine.Vector2")
                        {
                            tempVector2 = tempStruct.initialVector2;

                            if (tempStruct.modifyParameter1)
                                tempVector2.x = UpdateAnimation(tempStruct.initialVector2.x, tempStruct.targetVector2.x, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.modifyParameter2)
                                tempVector2.y = UpdateAnimation(tempStruct.initialVector2.y, tempStruct.targetVector2.y, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.valueType == ValType.Field)
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempVector2);
                            else if (tempStruct.valueType == ValType.Property)
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempVector2, null);
                        }
                        else if (tempStruct.variableType == "UnityEngine.Vector3")
                        {
                            tempVector3 = tempStruct.initialVector3;

                            if (tempStruct.modifyParameter1)
                                tempVector3.x = UpdateAnimation(tempStruct.initialVector3.x, tempStruct.targetVector3.x, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.modifyParameter2)
                                tempVector3.y = UpdateAnimation(tempStruct.initialVector3.y, tempStruct.targetVector3.y, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.modifyParameter3)
                                tempVector3.z = UpdateAnimation(tempStruct.initialVector3.z, tempStruct.targetVector3.z, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.valueType == ValType.Field)
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempVector3);
                            else if (tempStruct.valueType == ValType.Property)
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempVector3, null);
                        }
                        else if (tempStruct.variableType == "UnityEngine.Rect")
                        {
                            tempRect = tempStruct.initialRect;

                            if (tempStruct.modifyParameter1)
                                tempRect.x = UpdateAnimation(tempStruct.initialRect.x, tempStruct.targetRect.x, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.modifyParameter2)
                                tempRect.y = UpdateAnimation(tempStruct.initialRect.y, tempStruct.targetRect.y, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.modifyParameter3)
                                tempRect.width = UpdateAnimation(tempStruct.initialRect.width, tempStruct.targetRect.width, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.modifyParameter4)
                                tempRect.height = UpdateAnimation(tempStruct.initialRect.height, tempStruct.targetRect.height, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.valueType == ValType.Field)
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempRect);
                            else if (tempStruct.valueType == ValType.Property)
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempRect, null);
                        }
                        else if (tempStruct.variableType == "UnityEngine.Color")
                        {
                            tempColor = tempStruct.initialColor;

                            if (tempStruct.modifyParameter1)
                                tempColor.r = UpdateAnimation(tempStruct.initialColor.r, tempStruct.targetColor.r, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.modifyParameter2)
                                tempColor.g = UpdateAnimation(tempStruct.initialColor.g, tempStruct.targetColor.g, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.modifyParameter3)
                                tempColor.b = UpdateAnimation(tempStruct.initialColor.b, tempStruct.targetColor.b, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.modifyParameter4)
                                tempColor.a = UpdateAnimation(tempStruct.initialColor.a, tempStruct.targetColor.a, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.valueType == ValType.Field)
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempColor);
                            else if (tempStruct.valueType == ValType.Property)
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempColor, null);
                        }
                        else if (tempStruct.variableType == "UnityEngine.Material")
                        {
                            tempMaterial = tempStruct.initialMaterial;
                            tempColor = tempMaterial.color;

                            if (tempStruct.modifyParameter1)
                                tempColor.r = UpdateAnimation(tempStruct.initialColor.r, tempStruct.initialColor.r, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.modifyParameter2)
                                tempColor.g = UpdateAnimation(tempStruct.initialColor.g, tempStruct.initialColor.g, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.modifyParameter3)
                                tempColor.b = UpdateAnimation(tempStruct.initialColor.b, tempStruct.initialColor.b, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.modifyParameter4)
                                tempColor.a = UpdateAnimation(tempStruct.initialColor.a, tempStruct.initialColor.a, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            tempMaterial.color = tempColor;

                            if (tempStruct.valueType == ValType.Field)
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempMaterial);
                            else if (tempStruct.valueType == ValType.Property)
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempMaterial, null);
                        }
                    }
                    else
                    {
                        if (tempStruct.variableType == "System.Single")
                        {
                            tempFloat = tempStruct.targetFloat;

                            if (tempStruct.valueType == ValType.Field)
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempFloat);
                            else if (tempStruct.valueType == ValType.Property)
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempFloat, null);
                        }
                        else if (tempStruct.variableType == "System.Int32")
                        {
                            tempFloat = tempStruct.targetFloat;

                            if (tempStruct.valueType == ValType.Field)
                                tempStruct.realField.SetValue(tempStruct.RealComponent, Mathf.RoundToInt(tempFloat));
                            else if (tempStruct.valueType == ValType.Property)
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, Mathf.RoundToInt(tempFloat), null);
                        }
                        else if (tempStruct.variableType == "UnityEngine.Vector2")
                        {
                            tempVector2 = tempStruct.initialVector2;

                            if (tempStruct.modifyParameter1)
                                tempVector2.x = tempStruct.targetVector2.x;

                            if (tempStruct.modifyParameter2)
                                tempVector2.y = tempStruct.targetVector2.y;

                            if (tempStruct.valueType == ValType.Field)
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempVector2);
                            else if (tempStruct.valueType == ValType.Property)
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempVector2, null);
                        }
                        else if (tempStruct.variableType == "UnityEngine.Vector3")
                        {
                            tempVector3 = tempStruct.initialVector3;

                            if (tempStruct.modifyParameter1)
                                tempVector3.x = tempStruct.targetVector3.x;

                            if (tempStruct.modifyParameter2)
                                tempVector3.y = tempStruct.targetVector3.y;

                            if (tempStruct.modifyParameter3)
                                tempVector3.z = tempStruct.targetVector3.z;

                            if (tempStruct.valueType == ValType.Field)
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempVector3);
                            else if (tempStruct.valueType == ValType.Property)
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempVector3, null);
                        }
                        else if (tempStruct.variableType == "UnityEngine.Rect")
                        {
                            tempRect = tempStruct.initialRect;

                            if (tempStruct.modifyParameter1)
                                tempRect.x = tempStruct.targetRect.x;

                            if (tempStruct.modifyParameter2)
                                tempRect.y = tempStruct.targetRect.y;

                            if (tempStruct.modifyParameter3)
                                tempRect.width = tempStruct.targetRect.width;

                            if (tempStruct.modifyParameter4)
                                tempRect.height = tempStruct.targetRect.height;

                            if (tempStruct.valueType == ValType.Field)
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempRect);
                            else if (tempStruct.valueType == ValType.Property)
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempRect, null);
                        }
                        else if (tempStruct.variableType == "UnityEngine.Color")
                        {
                            tempColor = tempStruct.initialColor;

                            if (tempStruct.modifyParameter1)
                                tempColor.r = tempStruct.targetColor.r;

                            if (tempStruct.modifyParameter2)
                                tempColor.g = tempStruct.targetColor.g;

                            if (tempStruct.modifyParameter3)
                                tempColor.b = tempStruct.targetColor.b;

                            if (tempStruct.modifyParameter4)
                                tempColor.a = tempStruct.targetColor.a;

                            if (tempStruct.valueType == ValType.Field)
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempColor);
                            else if (tempStruct.valueType == ValType.Property)
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempColor, null);
                        }
                        else if (tempStruct.variableType == "UnityEngine.Material")
                        {
                            tempMaterial = tempStruct.initialMaterial;
                            tempColor = tempMaterial.color;

                            if (tempStruct.modifyParameter1)
                                tempColor.r = tempStruct.initialColor.r;

                            if (tempStruct.modifyParameter2)
                                tempColor.g = tempStruct.initialColor.g;

                            if (tempStruct.modifyParameter3)
                                tempColor.b = tempStruct.initialColor.b;

                            if (tempStruct.modifyParameter4)
                                tempColor.a = tempStruct.initialColor.a;

                            tempMaterial.color = tempColor;

                            if (tempStruct.valueType == ValType.Field)
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempMaterial);
                            else if (tempStruct.valueType == ValType.Property)
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempMaterial, null);
                        }
                        activeList[i] = false;

                        if (tempStruct.methodOnEnd && !tempStruct.called)
                        {
                            StartCoroutine(delayedCall());
                            oldStruct = tempStruct;
                            tempStruct.called = true;
                        }
                    }

                    theStructs[i] = tempStruct;
                }
            }
        }
Exemplo n.º 7
0
        void ConfigureStruct(int index)
        {
            tempStruct = scriptTarget.theStructs[index];

            string[] compStrings = tempStruct.targetGameObject != null ? FindComponentStrings(tempStruct.targetGameObject) : new string[] { "No object selected" };
            string[] varStrings = tempStruct.targetGameObject != null ? FindVariableStrings(tempStruct.targetGameObject, tempStruct.targetComponent) : new string[] { "No object selected" };

            tempStruct.animName = EditorGUILayout.TextField("Name", tempStruct.animName);
            tempStruct.animTag = EditorGUILayout.TextField("Tag", tempStruct.animTag);

            EditorGUILayout.Space();

            tempStruct.targetGameObject = (GameObject)EditorGUILayout.ObjectField("Target GameObject", tempStruct.targetGameObject, typeof(GameObject), true);

            if (tempStruct.targetGameObject)
                tempStruct.targetComponent = StringPopup("Target Component", compStrings, tempStruct.targetComponent);

            if (tempStruct.targetGameObject && tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent))
                tempStruct.targetVariable = StringPopup("Target Variable", varStrings, tempStruct.targetVariable);

            EditorGUILayout.Space();

            if (tempStruct.valueType == ValType.Field)
            {
                if (tempStruct.targetGameObject != null && tempStruct.targetComponent != null)
                {
                    if (tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent))
                    {
                        if (tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent).GetType().GetField(tempStruct.targetVariable) != null)
                        {
                            tempStruct.realField = tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent).GetType().GetField(tempStruct.targetVariable);

                            for (int i = 0; i < inclusions.Length; i++)
                            {
                                if (tempStruct.realField.FieldType.ToString() == inclusions[i])
                                {
                                    EditorGUILayout.LabelField("Variable is of type " + inclusionNames[i]);
                                    tempStruct.variableType = inclusions[i];
                                }
                            }
                        }
                        else
                            tempStruct.variableType = "";
                    }
                    else
                        tempStruct.variableType = "";
                }
                else
                    tempStruct.variableType = "";
            }
            else if (tempStruct.valueType == ValType.Property)
            {
                if (tempStruct.targetGameObject != null && tempStruct.targetComponent != null)
                {
                    if (tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent))
                    {
                        if (tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent).GetType().GetProperty(tempStruct.targetVariable) != null)
                        {
                            tempStruct.realProperty = tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent).GetType().GetProperty(tempStruct.targetVariable);

                            for (int i = 0; i < inclusions.Length; i++)
                            {
                                if (tempStruct.realProperty.PropertyType.ToString() == inclusions[i])
                                {
                                    EditorGUILayout.LabelField("Variable is of type " + inclusionNames[i]);
                                    tempStruct.variableType = inclusions[i];
                                }
                            }
                        }
                        else
                            tempStruct.variableType = "";
                    }
                    else
                        tempStruct.variableType = "";
                }
                else
                    tempStruct.variableType = "";
            }

            EditorGUILayout.Space();

            if (tempStruct.variableType == "System.Single")
            {
                tempStruct.targetFloat = EditorGUILayout.FloatField("Target float", tempStruct.targetFloat);
            }
            else if (tempStruct.variableType == "System.Int32")
            {
                tempStruct.targetInt = EditorGUILayout.IntField("Target int", tempStruct.targetInt);
            }
            else if (tempStruct.variableType == "UnityEngine.Vector2")
            {
                tempStruct.modifyParameter1 = EditorGUILayout.Toggle("Modify x parameter", tempStruct.modifyParameter1);

                tempStruct.modifyParameter2 = EditorGUILayout.Toggle("Modify y parameter", tempStruct.modifyParameter2);

                tempStruct.targetVector2 = EditorGUILayout.Vector2Field("Target Vector 2", tempStruct.targetVector2);
            }
            else if (tempStruct.variableType == "UnityEngine.Vector3")
            {
                tempStruct.modifyParameter1 = EditorGUILayout.Toggle("Modify x parameter", tempStruct.modifyParameter1);

                tempStruct.modifyParameter2 = EditorGUILayout.Toggle("Modify y parameter", tempStruct.modifyParameter2);

                tempStruct.modifyParameter3 = EditorGUILayout.Toggle("Modify z parameter", tempStruct.modifyParameter3);

                tempStruct.targetVector3 = EditorGUILayout.Vector3Field("Target Vector 3", tempStruct.targetVector3);
            }
            else if (tempStruct.variableType == "UnityEngine.Rect")
            {
                tempStruct.modifyParameter1 = EditorGUILayout.Toggle("Modify x parameter", tempStruct.modifyParameter1);

                tempStruct.modifyParameter2 = EditorGUILayout.Toggle("Modify y parameter", tempStruct.modifyParameter2);

                tempStruct.modifyParameter3 = EditorGUILayout.Toggle("Modify width parameter", tempStruct.modifyParameter3);

                tempStruct.modifyParameter4 = EditorGUILayout.Toggle("Modify height parameter", tempStruct.modifyParameter4);

                tempStruct.targetRect = EditorGUILayout.RectField("Target Rect", tempStruct.targetRect);
            }
            else if (tempStruct.variableType == "UnityEngine.Color" || tempStruct.variableType == "UnityEngine.Material")
            {
                tempStruct.modifyParameter1 = EditorGUILayout.Toggle("Modify red parameter", tempStruct.modifyParameter1);

                tempStruct.modifyParameter2 = EditorGUILayout.Toggle("Modify green parameter", tempStruct.modifyParameter2);

                tempStruct.modifyParameter3 = EditorGUILayout.Toggle("Modify blue parameter", tempStruct.modifyParameter3);

                tempStruct.modifyParameter4 = EditorGUILayout.Toggle("Modify alpha parameter", tempStruct.modifyParameter4);

                tempStruct.targetColor = EditorGUILayout.ColorField("Target Color", tempStruct.targetColor);
            }

            if (tempStruct.targetVariable != "" && tempStruct.targetGameObject != null && tempStruct.targetComponent != null)
            {
                EditorGUILayout.Space();

                tempStruct.animationType = (AnimType) EditorGUILayout.EnumPopup("Animation Type", tempStruct.animationType);

                tempStruct.animationDuration = EditorGUILayout.FloatField("Animation Duration", tempStruct.animationDuration);

                tempStruct.delay = EditorGUILayout.FloatField("Start delay (Seconds)", tempStruct.delay);
            }

            if (tempStruct.targetVariable != "" && tempStruct.targetGameObject != null && tempStruct.targetComponent != null)
            {
                tempStruct.methodOnEnd = EditorGUILayout.Toggle("Call function on animation end", tempStruct.methodOnEnd);

                if (tempStruct.methodOnEnd)
                {
                    EditorGUILayout.Space();

                    string[] endMethodCompStrings = tempStruct.methodTargetGameObject != null
                        ? FindComponentStrings(tempStruct.methodTargetGameObject)
                        : new string[] {"No object selected"};
                    string[] endMethodStrings = tempStruct.methodTargetGameObject != null
                        ? FindMethodStrings(tempStruct.methodTargetGameObject, tempStruct.methodTargetComponent)
                        : new string[] {"No object selected"};

                    tempStruct.methodTargetGameObject =
                        (GameObject)
                            EditorGUILayout.ObjectField("Target GameObject", tempStruct.methodTargetGameObject, typeof (GameObject), true);

                    if (tempStruct.methodTargetGameObject)
                        tempStruct.methodTargetComponent = StringPopup("Target Component", endMethodCompStrings,
                            tempStruct.methodTargetComponent);

                    if (tempStruct.methodTargetGameObject &&
                        tempStruct.methodTargetGameObject.GetComponent(tempStruct.methodTargetComponent))
                        tempStruct.methodTargetMethod = StringPopup("Target Function", endMethodStrings, tempStruct.methodTargetMethod);

                    if (tempStruct.methodTargetGameObject &&
                        tempStruct.methodTargetGameObject.GetComponent(tempStruct.methodTargetComponent) &&
                        tempStruct.methodTargetMethod != "")
                    {
                        tempStruct.methodParam = EditorGUILayout.TextField("Function argument", tempStruct.methodParam);
                    }
                }
            }
            else
            {
                tempStruct.methodOnEnd = false;
            }

            scriptTarget.theStructs[index] = tempStruct;
        }
Exemplo n.º 8
0
        private void AnimStruct(int i)
        {
            activeList[i] = true;
            tempStruct    = theStructs[i];

            tempStruct.animStartTime = Time.realtimeSinceStartup + tempStruct.delay;

            if (tempStruct.variableType == "System.Single")
            {
                if (tempStruct.valueType == ValType.Field)
                {
                    tempStruct.initialFloat = (float)tempStruct.realField.GetValue(tempStruct.RealComponent);
                }
                else if (tempStruct.valueType == ValType.Property)
                {
                    tempStruct.initialFloat = (float)tempStruct.realProperty.GetValue(tempStruct.RealComponent, null);
                }
            }
            else if (tempStruct.variableType == "System.Int32")
            {
                if (tempStruct.valueType == ValType.Field)
                {
                    tempStruct.initialInt = (int)tempStruct.realField.GetValue(tempStruct.RealComponent);
                }
                else if (tempStruct.valueType == ValType.Property)
                {
                    tempStruct.initialInt = (int)tempStruct.realProperty.GetValue(tempStruct.RealComponent, null);
                }
            }
            else if (tempStruct.variableType == "UnityEngine.Vector2")
            {
                if (tempStruct.valueType == ValType.Field)
                {
                    tempStruct.initialVector2 = (Vector2)tempStruct.realField.GetValue(tempStruct.RealComponent);
                }
                else if (tempStruct.valueType == ValType.Property)
                {
                    tempStruct.initialVector2 = (Vector2)tempStruct.realProperty.GetValue(tempStruct.RealComponent, null);
                }
            }
            else if (tempStruct.variableType == "UnityEngine.Vector3")
            {
                if (tempStruct.valueType == ValType.Field)
                {
                    tempStruct.initialVector3 = (Vector3)tempStruct.realField.GetValue(tempStruct.RealComponent);
                }
                else if (tempStruct.valueType == ValType.Property)
                {
                    tempStruct.initialVector3 = (Vector3)tempStruct.realProperty.GetValue(tempStruct.RealComponent, null);
                }
            }
            else if (tempStruct.variableType == "UnityEngine.Rect")
            {
                if (tempStruct.valueType == ValType.Field)
                {
                    tempStruct.initialRect = (Rect)tempStruct.realField.GetValue(tempStruct.RealComponent);
                }
                else if (tempStruct.valueType == ValType.Property)
                {
                    tempStruct.initialRect = (Rect)tempStruct.realProperty.GetValue(tempStruct.RealComponent, null);
                }
            }
            else if (tempStruct.variableType == "UnityEngine.Color")
            {
                if (tempStruct.valueType == ValType.Field)
                {
                    tempStruct.initialColor = (Color)tempStruct.realField.GetValue(tempStruct.RealComponent);
                }
                else if (tempStruct.valueType == ValType.Property)
                {
                    tempStruct.initialColor = (Color)tempStruct.realProperty.GetValue(tempStruct.RealComponent, null);
                }
            }
            else if (tempStruct.variableType == "UnityEngine.Material")
            {
                if (tempStruct.valueType == ValType.Field)
                {
                    tempStruct.initialMaterial = (Material)tempStruct.realField.GetValue(tempStruct.RealComponent);
                }
                else if (tempStruct.valueType == ValType.Property)
                {
                    tempStruct.initialMaterial = (Material)tempStruct.realProperty.GetValue(tempStruct.RealComponent, null);
                }
            }

            tempStruct.called = false;

            theStructs[i] = tempStruct;
        }
Exemplo n.º 9
0
        void Update()
        {
            for (int i = 0; i < theStructs.Count; i++)
            {
                if (activeList[i] == true)
                {
                    tempStruct = theStructs[i];

                    tempStruct.animDeltaTime = Time.realtimeSinceStartup - tempStruct.animStartTime;

                    skipSet = false;

                    if (tempStruct.animDeltaTime < tempStruct.animationDuration)
                    {
                        if (tempStruct.variableType == "System.Single")
                        {
                            tempFloat = UpdateAnimation(tempStruct.initialFloat, tempStruct.targetFloat, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.valueType == ValType.Field)
                            {
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempFloat);
                            }
                            else if (tempStruct.valueType == ValType.Property)
                            {
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempFloat, null);
                            }
                        }
                        else if (tempStruct.variableType == "System.Int32")
                        {
                            tempFloat = UpdateAnimation(tempStruct.initialInt, tempStruct.targetInt, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);

                            if (tempStruct.valueType == ValType.Field)
                            {
                                tempStruct.realField.SetValue(tempStruct.RealComponent, Mathf.RoundToInt(tempFloat));
                            }
                            else if (tempStruct.valueType == ValType.Property)
                            {
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, Mathf.RoundToInt(tempFloat), null);
                            }
                        }
                        else if (tempStruct.variableType == "UnityEngine.Vector2")
                        {
                            tempVector2 = tempStruct.initialVector2;

                            if (tempStruct.modifyParameter1)
                            {
                                tempVector2.x = UpdateAnimation(tempStruct.initialVector2.x, tempStruct.targetVector2.x, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.modifyParameter2)
                            {
                                tempVector2.y = UpdateAnimation(tempStruct.initialVector2.y, tempStruct.targetVector2.y, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.valueType == ValType.Field)
                            {
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempVector2);
                            }
                            else if (tempStruct.valueType == ValType.Property)
                            {
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempVector2, null);
                            }
                        }
                        else if (tempStruct.variableType == "UnityEngine.Vector3")
                        {
                            tempVector3 = tempStruct.initialVector3;

                            if (tempStruct.modifyParameter1)
                            {
                                tempVector3.x = UpdateAnimation(tempStruct.initialVector3.x, tempStruct.targetVector3.x, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.modifyParameter2)
                            {
                                tempVector3.y = UpdateAnimation(tempStruct.initialVector3.y, tempStruct.targetVector3.y, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.modifyParameter3)
                            {
                                tempVector3.z = UpdateAnimation(tempStruct.initialVector3.z, tempStruct.targetVector3.z, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.valueType == ValType.Field)
                            {
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempVector3);
                            }
                            else if (tempStruct.valueType == ValType.Property)
                            {
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempVector3, null);
                            }
                        }
                        else if (tempStruct.variableType == "UnityEngine.Rect")
                        {
                            tempRect = tempStruct.initialRect;

                            if (tempStruct.modifyParameter1)
                            {
                                tempRect.x = UpdateAnimation(tempStruct.initialRect.x, tempStruct.targetRect.x, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.modifyParameter2)
                            {
                                tempRect.y = UpdateAnimation(tempStruct.initialRect.y, tempStruct.targetRect.y, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.modifyParameter3)
                            {
                                tempRect.width = UpdateAnimation(tempStruct.initialRect.width, tempStruct.targetRect.width, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.modifyParameter4)
                            {
                                tempRect.height = UpdateAnimation(tempStruct.initialRect.height, tempStruct.targetRect.height, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.valueType == ValType.Field)
                            {
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempRect);
                            }
                            else if (tempStruct.valueType == ValType.Property)
                            {
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempRect, null);
                            }
                        }
                        else if (tempStruct.variableType == "UnityEngine.Color")
                        {
                            tempColor = tempStruct.initialColor;

                            if (tempStruct.modifyParameter1)
                            {
                                tempColor.r = UpdateAnimation(tempStruct.initialColor.r, tempStruct.targetColor.r, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.modifyParameter2)
                            {
                                tempColor.g = UpdateAnimation(tempStruct.initialColor.g, tempStruct.targetColor.g, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.modifyParameter3)
                            {
                                tempColor.b = UpdateAnimation(tempStruct.initialColor.b, tempStruct.targetColor.b, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.modifyParameter4)
                            {
                                tempColor.a = UpdateAnimation(tempStruct.initialColor.a, tempStruct.targetColor.a, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.valueType == ValType.Field)
                            {
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempColor);
                            }
                            else if (tempStruct.valueType == ValType.Property)
                            {
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempColor, null);
                            }
                        }
                        else if (tempStruct.variableType == "UnityEngine.Material")
                        {
                            tempMaterial = tempStruct.initialMaterial;
                            tempColor    = tempMaterial.color;

                            if (tempStruct.modifyParameter1)
                            {
                                tempColor.r = UpdateAnimation(tempStruct.initialColor.r, tempStruct.initialColor.r, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.modifyParameter2)
                            {
                                tempColor.g = UpdateAnimation(tempStruct.initialColor.g, tempStruct.initialColor.g, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.modifyParameter3)
                            {
                                tempColor.b = UpdateAnimation(tempStruct.initialColor.b, tempStruct.initialColor.b, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            if (tempStruct.modifyParameter4)
                            {
                                tempColor.a = UpdateAnimation(tempStruct.initialColor.a, tempStruct.initialColor.a, tempStruct.animDeltaTime, tempStruct.animationDuration, tempStruct.animationType);
                            }

                            tempMaterial.color = tempColor;

                            if (tempStruct.valueType == ValType.Field)
                            {
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempMaterial);
                            }
                            else if (tempStruct.valueType == ValType.Property)
                            {
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempMaterial, null);
                            }
                        }
                    }
                    else
                    {
                        if (tempStruct.variableType == "System.Single")
                        {
                            tempFloat = tempStruct.targetFloat;

                            if (tempStruct.valueType == ValType.Field)
                            {
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempFloat);
                            }
                            else if (tempStruct.valueType == ValType.Property)
                            {
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempFloat, null);
                            }
                        }
                        else if (tempStruct.variableType == "System.Int32")
                        {
                            tempFloat = tempStruct.targetFloat;

                            if (tempStruct.valueType == ValType.Field)
                            {
                                tempStruct.realField.SetValue(tempStruct.RealComponent, Mathf.RoundToInt(tempFloat));
                            }
                            else if (tempStruct.valueType == ValType.Property)
                            {
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, Mathf.RoundToInt(tempFloat), null);
                            }
                        }
                        else if (tempStruct.variableType == "UnityEngine.Vector2")
                        {
                            tempVector2 = tempStruct.initialVector2;

                            if (tempStruct.modifyParameter1)
                            {
                                tempVector2.x = tempStruct.targetVector2.x;
                            }

                            if (tempStruct.modifyParameter2)
                            {
                                tempVector2.y = tempStruct.targetVector2.y;
                            }

                            if (tempStruct.valueType == ValType.Field)
                            {
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempVector2);
                            }
                            else if (tempStruct.valueType == ValType.Property)
                            {
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempVector2, null);
                            }
                        }
                        else if (tempStruct.variableType == "UnityEngine.Vector3")
                        {
                            tempVector3 = tempStruct.initialVector3;

                            if (tempStruct.modifyParameter1)
                            {
                                tempVector3.x = tempStruct.targetVector3.x;
                            }

                            if (tempStruct.modifyParameter2)
                            {
                                tempVector3.y = tempStruct.targetVector3.y;
                            }

                            if (tempStruct.modifyParameter3)
                            {
                                tempVector3.z = tempStruct.targetVector3.z;
                            }

                            if (tempStruct.valueType == ValType.Field)
                            {
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempVector3);
                            }
                            else if (tempStruct.valueType == ValType.Property)
                            {
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempVector3, null);
                            }
                        }
                        else if (tempStruct.variableType == "UnityEngine.Rect")
                        {
                            tempRect = tempStruct.initialRect;

                            if (tempStruct.modifyParameter1)
                            {
                                tempRect.x = tempStruct.targetRect.x;
                            }

                            if (tempStruct.modifyParameter2)
                            {
                                tempRect.y = tempStruct.targetRect.y;
                            }

                            if (tempStruct.modifyParameter3)
                            {
                                tempRect.width = tempStruct.targetRect.width;
                            }

                            if (tempStruct.modifyParameter4)
                            {
                                tempRect.height = tempStruct.targetRect.height;
                            }

                            if (tempStruct.valueType == ValType.Field)
                            {
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempRect);
                            }
                            else if (tempStruct.valueType == ValType.Property)
                            {
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempRect, null);
                            }
                        }
                        else if (tempStruct.variableType == "UnityEngine.Color")
                        {
                            tempColor = tempStruct.initialColor;

                            if (tempStruct.modifyParameter1)
                            {
                                tempColor.r = tempStruct.targetColor.r;
                            }

                            if (tempStruct.modifyParameter2)
                            {
                                tempColor.g = tempStruct.targetColor.g;
                            }

                            if (tempStruct.modifyParameter3)
                            {
                                tempColor.b = tempStruct.targetColor.b;
                            }

                            if (tempStruct.modifyParameter4)
                            {
                                tempColor.a = tempStruct.targetColor.a;
                            }

                            if (tempStruct.valueType == ValType.Field)
                            {
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempColor);
                            }
                            else if (tempStruct.valueType == ValType.Property)
                            {
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempColor, null);
                            }
                        }
                        else if (tempStruct.variableType == "UnityEngine.Material")
                        {
                            tempMaterial = tempStruct.initialMaterial;
                            tempColor    = tempMaterial.color;

                            if (tempStruct.modifyParameter1)
                            {
                                tempColor.r = tempStruct.initialColor.r;
                            }

                            if (tempStruct.modifyParameter2)
                            {
                                tempColor.g = tempStruct.initialColor.g;
                            }

                            if (tempStruct.modifyParameter3)
                            {
                                tempColor.b = tempStruct.initialColor.b;
                            }

                            if (tempStruct.modifyParameter4)
                            {
                                tempColor.a = tempStruct.initialColor.a;
                            }

                            tempMaterial.color = tempColor;

                            if (tempStruct.valueType == ValType.Field)
                            {
                                tempStruct.realField.SetValue(tempStruct.RealComponent, tempMaterial);
                            }
                            else if (tempStruct.valueType == ValType.Property)
                            {
                                tempStruct.realProperty.SetValue(tempStruct.RealComponent, tempMaterial, null);
                            }
                        }
                        activeList[i] = false;

                        if (tempStruct.methodOnEnd && !tempStruct.called)
                        {
                            StartCoroutine(delayedCall());
                            oldStruct         = tempStruct;
                            tempStruct.called = true;
                        }
                    }

                    theStructs[i] = tempStruct;
                }
            }
        }
Exemplo n.º 10
0
        void ConfigureStruct(int index)
        {
            tempStruct = scriptTarget.theStructs[index];

            string[] compStrings = tempStruct.targetGameObject != null?FindComponentStrings(tempStruct.targetGameObject) : new string[]
            {
                "No object selected"
            };
            string[] varStrings = tempStruct.targetGameObject != null?FindVariableStrings(tempStruct.targetGameObject, tempStruct.targetComponent) : new string[]
            {
                "No object selected"
            };

            tempStruct.animName = EditorGUILayout.TextField("Name", tempStruct.animName);
            tempStruct.animTag  = EditorGUILayout.TextField("Tag", tempStruct.animTag);

            EditorGUILayout.Space();

            tempStruct.targetGameObject = (GameObject)EditorGUILayout.ObjectField("Target GameObject", tempStruct.targetGameObject, typeof(GameObject), true);

            if (tempStruct.targetGameObject)
            {
                tempStruct.targetComponent = StringPopup("Target Component", compStrings, tempStruct.targetComponent);
            }

            if (tempStruct.targetGameObject && tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent))
            {
                tempStruct.targetVariable = StringPopup("Target Variable", varStrings, tempStruct.targetVariable);
            }

            EditorGUILayout.Space();

            if (tempStruct.valueType == ValType.Field)
            {
                if (tempStruct.targetGameObject != null && tempStruct.targetComponent != null)
                {
                    if (tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent))
                    {
                        if (tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent).GetType().GetField(tempStruct.targetVariable) != null)
                        {
                            tempStruct.realField = tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent).GetType().GetField(tempStruct.targetVariable);

                            for (int i = 0; i < inclusions.Length; i++)
                            {
                                if (tempStruct.realField.FieldType.ToString() == inclusions[i])
                                {
                                    EditorGUILayout.LabelField("Variable is of type " + inclusionNames[i]);
                                    tempStruct.variableType = inclusions[i];
                                }
                            }
                        }
                        else
                        {
                            tempStruct.variableType = "";
                        }
                    }
                    else
                    {
                        tempStruct.variableType = "";
                    }
                }
                else
                {
                    tempStruct.variableType = "";
                }
            }
            else if (tempStruct.valueType == ValType.Property)
            {
                if (tempStruct.targetGameObject != null && tempStruct.targetComponent != null)
                {
                    if (tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent))
                    {
                        if (tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent).GetType().GetProperty(tempStruct.targetVariable) != null)
                        {
                            tempStruct.realProperty = tempStruct.targetGameObject.GetComponent(tempStruct.targetComponent).GetType().GetProperty(tempStruct.targetVariable);

                            for (int i = 0; i < inclusions.Length; i++)
                            {
                                if (tempStruct.realProperty.PropertyType.ToString() == inclusions[i])
                                {
                                    EditorGUILayout.LabelField("Variable is of type " + inclusionNames[i]);
                                    tempStruct.variableType = inclusions[i];
                                }
                            }
                        }
                        else
                        {
                            tempStruct.variableType = "";
                        }
                    }
                    else
                    {
                        tempStruct.variableType = "";
                    }
                }
                else
                {
                    tempStruct.variableType = "";
                }
            }

            EditorGUILayout.Space();

            if (tempStruct.variableType == "System.Single")
            {
                tempStruct.targetFloat = EditorGUILayout.FloatField("Target float", tempStruct.targetFloat);
            }
            else if (tempStruct.variableType == "System.Int32")
            {
                tempStruct.targetInt = EditorGUILayout.IntField("Target int", tempStruct.targetInt);
            }
            else if (tempStruct.variableType == "UnityEngine.Vector2")
            {
                tempStruct.modifyParameter1 = EditorGUILayout.Toggle("Modify x parameter", tempStruct.modifyParameter1);

                tempStruct.modifyParameter2 = EditorGUILayout.Toggle("Modify y parameter", tempStruct.modifyParameter2);

                tempStruct.targetVector2 = EditorGUILayout.Vector2Field("Target Vector 2", tempStruct.targetVector2);
            }
            else if (tempStruct.variableType == "UnityEngine.Vector3")
            {
                tempStruct.modifyParameter1 = EditorGUILayout.Toggle("Modify x parameter", tempStruct.modifyParameter1);

                tempStruct.modifyParameter2 = EditorGUILayout.Toggle("Modify y parameter", tempStruct.modifyParameter2);

                tempStruct.modifyParameter3 = EditorGUILayout.Toggle("Modify z parameter", tempStruct.modifyParameter3);

                tempStruct.targetVector3 = EditorGUILayout.Vector3Field("Target Vector 3", tempStruct.targetVector3);
            }
            else if (tempStruct.variableType == "UnityEngine.Rect")
            {
                tempStruct.modifyParameter1 = EditorGUILayout.Toggle("Modify x parameter", tempStruct.modifyParameter1);

                tempStruct.modifyParameter2 = EditorGUILayout.Toggle("Modify y parameter", tempStruct.modifyParameter2);

                tempStruct.modifyParameter3 = EditorGUILayout.Toggle("Modify width parameter", tempStruct.modifyParameter3);

                tempStruct.modifyParameter4 = EditorGUILayout.Toggle("Modify height parameter", tempStruct.modifyParameter4);

                tempStruct.targetRect = EditorGUILayout.RectField("Target Rect", tempStruct.targetRect);
            }
            else if (tempStruct.variableType == "UnityEngine.Color" || tempStruct.variableType == "UnityEngine.Material")
            {
                tempStruct.modifyParameter1 = EditorGUILayout.Toggle("Modify red parameter", tempStruct.modifyParameter1);

                tempStruct.modifyParameter2 = EditorGUILayout.Toggle("Modify green parameter", tempStruct.modifyParameter2);

                tempStruct.modifyParameter3 = EditorGUILayout.Toggle("Modify blue parameter", tempStruct.modifyParameter3);

                tempStruct.modifyParameter4 = EditorGUILayout.Toggle("Modify alpha parameter", tempStruct.modifyParameter4);

                tempStruct.targetColor = EditorGUILayout.ColorField("Target Color", tempStruct.targetColor);
            }

            if (tempStruct.targetVariable != "" && tempStruct.targetGameObject != null && tempStruct.targetComponent != null)
            {
                EditorGUILayout.Space();

                tempStruct.animationType = (AnimType)EditorGUILayout.EnumPopup("Animation Type", tempStruct.animationType);

                tempStruct.animationDuration = EditorGUILayout.FloatField("Animation Duration", tempStruct.animationDuration);

                tempStruct.delay = EditorGUILayout.FloatField("Start delay (Seconds)", tempStruct.delay);
            }


            if (tempStruct.targetVariable != "" && tempStruct.targetGameObject != null && tempStruct.targetComponent != null)
            {
                tempStruct.methodOnEnd = EditorGUILayout.Toggle("Call function on animation end", tempStruct.methodOnEnd);

                if (tempStruct.methodOnEnd)
                {
                    EditorGUILayout.Space();

                    string[] endMethodCompStrings = tempStruct.methodTargetGameObject != null
                                                ? FindComponentStrings(tempStruct.methodTargetGameObject)
                                                : new string[]
                    {
                        "No object selected"
                    };
                    string[] endMethodStrings = tempStruct.methodTargetGameObject != null
                                                ? FindMethodStrings(tempStruct.methodTargetGameObject, tempStruct.methodTargetComponent)
                                                : new string[]
                    {
                        "No object selected"
                    };

                    tempStruct.methodTargetGameObject =
                        (GameObject)
                        EditorGUILayout.ObjectField("Target GameObject", tempStruct.methodTargetGameObject, typeof(GameObject), true);

                    if (tempStruct.methodTargetGameObject)
                    {
                        tempStruct.methodTargetComponent = StringPopup("Target Component", endMethodCompStrings,
                                                                       tempStruct.methodTargetComponent);
                    }

                    if (tempStruct.methodTargetGameObject &&
                        tempStruct.methodTargetGameObject.GetComponent(tempStruct.methodTargetComponent))
                    {
                        tempStruct.methodTargetMethod = StringPopup("Target Function", endMethodStrings, tempStruct.methodTargetMethod);
                    }

                    if (tempStruct.methodTargetGameObject &&
                        tempStruct.methodTargetGameObject.GetComponent(tempStruct.methodTargetComponent) &&
                        tempStruct.methodTargetMethod != "")
                    {
                        tempStruct.methodParam = EditorGUILayout.TextField("Function argument", tempStruct.methodParam);
                    }
                }
            }
            else
            {
                tempStruct.methodOnEnd = false;
            }

            scriptTarget.theStructs[index] = tempStruct;
        }