public static void FixupStateRefs(TimelineStateMachine timeLineStateMachine, object obj)
            {
                if (obj != null)
                {
                    object[] nodeFieldObjects = SerializedFieldInfo.GetSerializedFieldInstances(obj);

                    foreach (object nodeFieldObject in nodeFieldObjects)
                    {
                        TimelineStateRef stateRefProperty = nodeFieldObject as TimelineStateRef;

                        if (stateRefProperty != null)
                        {
                            stateRefProperty.FixUpRef(timeLineStateMachine);
                        }
                        else
                        {
#if UNITY_EDITOR
                            LocalisedStringRef localisedstring = nodeFieldObject as LocalisedStringRef;

                            if (localisedstring != null)
                            {
                                localisedstring.SetEditorStateMachine(timeLineStateMachine);
                            }
#endif
                        }

                        FixupStateRefs(timeLineStateMachine, nodeFieldObject);
                    }
                }
            }
Beispiel #2
0
            private static IEnumerator DoStateThenGoTo(StateMachine stateMachine, TimelineStateRef TimelineState, TimelineStateRef goToState)
            {
                yield return(stateMachine.StartCoroutine(TimelineStateMachine.Run(stateMachine, TimelineState)));

                stateMachine.GoToState(TimelineStateMachine.Run(stateMachine, goToState));

                yield break;
            }
            public static IEnumerator Run(StateMachine stateMachine, TimelineStateRef stateRef, GameObject sourceObject = null)
            {
                TimelineState state = stateRef.GetTimelineState(sourceObject != null ? sourceObject : stateMachine.gameObject);

                if (state != null)
                {
#if UNITY_EDITOR && DEBUG
                    string debugFileName = stateRef._file._filePath;
                    TimelineStateMachineDebug.OnTimelineStateStarted(stateMachine, state, debugFileName);
#endif
                    return(PerformState(stateMachine, state, state._timeline));
                }

                return(null);
            }