Пример #1
0
        /// <summary>
        /// Handle timers for tap-ignore and autotransition.
        /// </summary>
        private void Update()
        {
            m_timeSinceTap = Time.time - m_timeAtTap;

            // passed final stage? nothing else to do
            if (m_currentStage >= m_stages.Length)
            {
                return;
            }

            // handle autotransition
            if (m_stages[m_currentStage].autoTransitionDelay > 0.0f)
            {
                m_stages[m_currentStage].autoTransitionCounter += Time.deltaTime;
                if (m_stages[m_currentStage].autoTransitionCounter >= m_stages[m_currentStage].autoTransitionDelay)
                {
                    m_stages[m_currentStage].autoTransitionCounter = 0.0f;

                    if (OnAutoTransition != null)
                    {
                        OnAutoTransition.Invoke(m_currentStage + 1);
                    }

                    AdvanceStage();
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Return to designated starting stage; app is reponsible for its own cleanup and reinit.
        /// </summary>
        public void Restart()
        {
            if (OnLoopbackTransition != null)
            {
                OnLoopbackTransition.Invoke(m_currentStage + 1);
            }

            EnterStage(m_loopBackStage);

            foreach (FlowStage stage in m_stages)
            {
                if (stage.Events != null)
                {
                    foreach (DelayedEvent eventDelayed in stage.Events)
                    {
                        eventDelayed.Triggered = false;
                    }
                }
                if (stage.ExitEvents != null)
                {
                    foreach (DelayedEvent exitEvent in stage.ExitEvents)
                    {
                        exitEvent.Triggered = false;
                    }
                }
            }
        }
Пример #3
0
 public void TriggerEvent(string name)
 {
     try
     {
         TransitionEventDelegate del = m_DelegateMap[name];
         del.Invoke();
         Evaluate();
     }
     catch (KeyNotFoundException)
     {
         Log.Error(string.Format("Unable to find delegate event '{0}'", name));
     }
 }
Пример #4
0
        /// <summary>
        /// Initiate a user-selected stage transition.
        /// </summary>
        private void RequestTransition()
        {
            // Test for tap-ignore
            m_timeSinceTap = Time.time - m_timeAtTap;
            if (m_timeSinceTap > Mathf.Max(m_fastestTapTime, m_stages[m_currentStage].disableTapTime))
            {
                if (OnManualTransition != null)
                {
                    OnManualTransition.Invoke(m_currentStage + 1);
                }

                AdvanceStage();
            }
        }
Пример #5
0
        /// <summary>
        /// Sets up the new stage.
        /// </summary>
        /// <param name="newStageIdx">The new stage.</param>
        private void EnterStage(int newStageIdx)
        {
            FlowStage newStage = m_stages[newStageIdx];

            m_currentStage     = newStageIdx;
            m_currentStageName = newStage.Name;

            if (newStage.clickToAdvance)
            {
                ReceiveTaps(true);
            }
            m_timeAtTap = Time.time;

            newStage.autoTransitionCounter = 0.0f;

            TriggerEntryEvents(m_currentStage);

            if (OnStageTransition != null)
            {
                OnStageTransition.Invoke(m_currentStage);
            }
        }