Beispiel #1
0
        private void DoMethodCall()
        {
            if (className == null || string.IsNullOrEmpty(className.Value))
            {
                Finish();
                return;
            }

            if (cachedClassName != className.Value || cachedMethodName != methodName.Value)
            {
                errorString = string.Empty;
                if (!DoCache())
                {
                    Debug.LogError(errorString);
                    Finish();
                    return;
                }
            }

            object result = null;

            if (cachedParameterInfo.Length == 0)
            {
                result = cachedMethodInfo.Invoke(null, null);
            }
            else
            {
                for (var i = 0; i < parameters.Length; i++)
                {
                    var parameter = parameters[i];
                    parameter.UpdateValue();
                    parametersArray[i] = parameter.GetValue();
                }

                result = cachedMethodInfo.Invoke(null, parametersArray);
            }

            if (!storeResult.IsNone)
            {
                storeResult.SetValue(result);
            }

                        #if UNITY_EDITOR
            if (debug || LinkerData.DebugAll)
            {
                UnityEngine.Debug.Log("<Color=blue>CallStaticMethod</Color> on " + this.Fsm.GameObjectName + ":" + this.Fsm.Name + "\n" +
                                      "<Color=red>TargetType</Color>\t\t" + cachedType + "\n" +
                                      "<Color=red>Assembly</Color>\t\t" + cachedType.Assembly.FullName + "\n" +
                                      "<Color=red>Method</Color>\t\t\t" + cachedMethodInfo.Name + "\n");

                LinkerData.RegisterClassDependancy(cachedType, cachedType.ToString());
            }
                        #endif
        }
Beispiel #2
0
        public override void OnEnter()
        {
            targetProperty.GetValue();

                        #if UNITY_EDITOR
            if (debug || LinkerData.DebugAll)
            {
                UnityEngine.Debug.Log("<Color=blue>GetProperty</Color> on " + this.Fsm.GameObjectName + ":" + this.Fsm.Name + "\n" +
                                      "<Color=red>TargetType</Color>\t\t" + targetProperty.TargetTypeName + "\n" +
                                      "<Color=red>Assembly</Color>\t\t" + targetProperty.TargetType.Assembly.FullName + "\n" +
                                      "<Color=red>Property</Color>\t\t\t" + targetProperty.PropertyName + " <" + targetProperty.PropertyType + ">\n");

                LinkerData.RegisterClassDependancy(targetProperty.TargetType, targetProperty.TargetTypeName);
            }
                        #endif

            if (!everyFrame)
            {
                Finish();
            }
        }
Beispiel #3
0
        public override void OnEnter()
        {
            parametersArray = new object[parameters.Length];

            DoMethodCall();

                        #if UNITY_EDITOR
            if (debug || LinkerData.DebugAll)
            {
                UnityEngine.Debug.Log("<Color=blue>CallMethod</Color> on " + this.Fsm.GameObjectName + ":" + this.Fsm.Name + "\n" +
                                      "<Color=red>TargetType</Color>\t\t" + cachedType + "\n" +
                                      "<Color=red>Assembly</Color>\t\t" + cachedType.Assembly.FullName + "\n" +
                                      "<Color=red>Method</Color>\t\t\t" + cachedMethodInfo.Name + "\n");

                LinkerData.RegisterClassDependancy(cachedType, cachedType.ToString());
            }
                        #endif

            if (!everyFrame)
            {
                Finish();
            }
        }
Beispiel #4
0
        void DoInvokeMethod(GameObject go)
        {
            if (go == null)
            {
                return;
            }

            component = go.GetComponent(ReflectionUtils.GetGlobalType(behaviour.Value)) as MonoBehaviour;

            if (component == null)
            {
                LogWarning("InvokeMethod: " + go.name + " missing behaviour: " + behaviour.Value);
                return;
            }

            if (repeating.Value)
            {
                component.InvokeRepeating(methodName.Value, delay.Value, repeatDelay.Value);
            }
            else
            {
                component.Invoke(methodName.Value, delay.Value);
            }

                        #if UNITY_EDITOR
            if (debug || LinkerData.DebugAll)
            {
                UnityEngine.Debug.Log("<Color=blue>InvokeMethod</Color> on " + this.Fsm.GameObjectName + ":" + this.Fsm.Name + "\n" +
                                      "<Color=red>TargetType</Color>\t\t" + component.GetType() + "\n" +
                                      "<Color=red>Assembly</Color>\t\t" + component.GetType().Assembly.FullName + "\n" +
                                      "<Color=red>Method</Color>\t\t\t" + methodName.Value + "\n");

                LinkerData.RegisterClassDependancy(component.GetType(), component.GetType().ToString());
            }
                        #endif
        }