// Update is called once per frame
	void Update () 
	{
		switch( m_State )
		{
		case ConversationManagerState.UnActive :
			CheckQueue() ;
			break ;
		case ConversationManagerState.Starting :
			ShowDialogUI( true ) ;
			m_State = ConversationManagerState.WaitEnd ;
			break ;
		case ConversationManagerState.WaitEnd :
			WaitEnd() ;
			break ;
		case ConversationManagerState.WaitForInput :
			if( true == CheckIfPress() )
			{
				PlayNext() ;

			}
			break ;
		case ConversationManagerState.Closing :
			ShowDialogUI( false ) ;
			m_State = ConversationManagerState.Close ;
			break ;
		case ConversationManagerState.Close :
			m_State = ConversationManagerState.UnActive ;
			break ;			
		}
	
	}
Esempio n. 2
0
    private void CheckQueue()
    {
        if (ConversationManagerState.UnActive != m_State)
        {
            return;
        }

        if (m_StartingQueue.Count > 0)
        {
            int retreiveStoryUID = m_StartingQueue[0];
            m_StartingQueue.RemoveAt(0);

            Story s = GetStory(retreiveStoryUID);
            if (null != s)
            {
                m_CurrentStoryUID = retreiveStoryUID;
                m_CurrentTakeUID  = s.StartTakeUID;
                m_State           = ConversationManagerState.Starting;
            }
        }
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        switch (m_State)
        {
        case ConversationManagerState.UnActive:
            CheckQueue();
            break;

        case ConversationManagerState.Starting:
            ShowDialogUI(true);
#if ENABLE_USE_TIME
            m_State = ConversationManagerState.WaitEnd;
#else
            m_State = ConversationManagerState.WaitForInput;
#endif
            break;

        case ConversationManagerState.WaitEnd:
            WaitEnd();
            break;

        case ConversationManagerState.WaitForInput:
            if (true == CheckIfPress())
            {
                PlayNext();
            }
            break;

        case ConversationManagerState.Closing:
            ShowDialogUI(false);
            m_State = ConversationManagerState.Close;
            break;

        case ConversationManagerState.Close:
            m_State = ConversationManagerState.UnActive;
            break;
        }
    }
Esempio n. 4
0
    protected virtual void PlayNext()
    {
        Story story = GetStory(m_CurrentStoryUID);

        if (m_CurrentTakeUID == story.EndTakeUID)
        {
            // no more next
            // Debug.Log( "m_CurrentTakeUID == story.EndTakeUID" ) ;
            story.IsPlayed = true;
            m_State        = ConversationManagerState.Closing;
        }
        else
        {
            int takeIndex = GetTakeIndex(m_CurrentTakeUID);
            ++takeIndex;
            if (takeIndex >= m_Takes.Count)
            {
                // no more next
                // Debug.Log( "takeIndex >= m_Takes.Count" ) ;
                story.IsPlayed = true;
                m_State        = ConversationManagerState.Closing;
            }
            else
            {
                m_CurrentTakeUID = m_Takes[takeIndex].TakeUID;

                ShowDialogUI(true);

                                #if ENABLE_USE_TIME
                m_State = ConversationManagerState.WaitEnd;
                                #else
                m_State = ConversationManagerState.WaitForInput;
                                #endif
            }
        }
    }
	private void WaitEnd()
	{
		int index = GetTakeIndex( m_CurrentTakeUID ) ;
		if( index >= m_Takes.Count )
		{
			// warning
			return ;
		}

		Take currentTake = m_Takes[ index ] ;
		if( 0 == currentTake.WaitingTime )
		{
			m_State = ConversationManagerState.WaitForInput ;
		}
		else
		{
			float diffTime = Time.time - m_StartTime ;
			if( diffTime >= currentTake.WaitingTime )
			{
				PlayNext() ;
			}
		}

	}
	private void CheckQueue()
	{
		if( ConversationManagerState.UnActive != m_State )
			return ;

		if( m_StartingQueue.Count > 0 )
		{
			int retreiveStoryUID = m_StartingQueue[ 0 ] ;
			m_StartingQueue.RemoveAt( 0 ) ;


			Story s = GetStory( retreiveStoryUID ) ;
			if( null != s )
			{
				m_CurrentStoryUID = retreiveStoryUID ;
				m_CurrentTakeUID = s.StartTakeUID ;
				m_State = ConversationManagerState.Starting ;
			}

		}
	}
	private void PlayNext()
	{
		Story story = GetStory( m_CurrentStoryUID ) ;
		if( m_CurrentTakeUID == story.EndTakeUID )
		{
			// no more next
			// Debug.Log( "m_CurrentTakeUID == story.EndTakeUID" ) ;
			m_State = ConversationManagerState.Closing ;
		}
		else
		{
			int takeIndex = GetTakeIndex( m_CurrentTakeUID ) ;
			++takeIndex ;
			if( takeIndex >= m_Takes.Count )
			{
				// no more next
				// Debug.Log( "takeIndex >= m_Takes.Count" ) ;
				m_State = ConversationManagerState.Closing ;
			}
			else
			{
				m_CurrentTakeUID = m_Takes[ takeIndex ].UID ;

				ShowDialogUI( true ) ;

				m_State = ConversationManagerState.WaitEnd ;
			}
		}
	}