Example #1
0
        public object GetValue()
        {
            switch (typeFullname)
            {
            case "System.Int32":
                return(intValue);

            case "System.Boolean":
                return(boolValue);

            case "System.Single":
                return(floatValue);

            case "System.String":
                return(stringValue);

            case "UnityEngine.Color":
                return(colorValue);

            case "UnityEngine.GameObject":
                return(gameObjectValue);

            case "UnityEngine.Material":
                return(materialValue);

            case "UnityEngine.Sprite":
                return(spriteValue);

            case "UnityEngine.Texture":
                return(textureValue);

            case "UnityEngine.Vector2":
                return(vector2Value);

            case "UnityEngine.Vector3":
                return(vector3Value);

            default:
                var objType = ReflectionHelper.GetType(typeAssemblyname);

                if (objType.IsSubclassOf(typeof(UnityEngine.Object)))
                {
                    return(objectValue);
                }
                else if (objType.IsEnum())
                {
                    return(System.Enum.ToObject(objType, intValue));
                }

                break;
            }

            return(null);
        }
Example #2
0
        protected virtual System.Type[] GetParameterTypes()
        {
            System.Type[] types = new System.Type[methodParameters.Length];

            for (int i = 0; i < methodParameters.Length; i++)
            {
                var item    = methodParameters[i];
                var objType = ReflectionHelper.GetType(item.objValue.typeAssemblyname);

                types[i] = objType;
            }

            return(types);
        }
Example #3
0
        protected virtual void Awake()
        {
            if (componentType == null)
            {
                componentType = ReflectionHelper.GetType(targetComponentAssemblyName);
            }

            if (objComponent == null)
            {
                objComponent = targetObject.GetComponent(componentType);
            }

            if (parameterTypes == null)
            {
                parameterTypes = GetParameterTypes();
            }

            if (objMethod == null)
            {
                objMethod = UnityEvent.GetValidMethodInfo(objComponent, targetMethod, parameterTypes);
            }
        }