Beispiel #1
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Update Movement
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    protected virtual void UpdateMovement()
    {
        // If Finished Path, DestroySelf
        if (m_FlightPath.AtEndOfArray())
        {
            RunEndOfFlightPathCommand();
        }
        else
        {
            MoveTowardsTarget();

            if (IsCloseEnoughToTargetPosition())
            {
                // Move on to the Next Path Node
                m_FlightPath.IncrementElement();
            }
        }
    }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Update Text
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private void UpdateText()
    {
        if (!m_aTextArray.AtEndOfArray())
        {
            if (m_SoundFiles.TextSource != null)
            {
                if (!m_SoundFiles.TextSource.isPlaying)
                {
                    m_SoundFiles.TextSource.Play();
                }
            }

            // Update Text (H...e...l...l...o) and Face Animation, if there is still text
            if (m_iCurrentCharElement < GetCurrentWindowText().Length)
            {
                m_TTTextTimer.Update();
                m_TTFaceAnimationTimer.Update();

                if (m_TTTextTimer.TimeUp())
                {
                    GetLabelScript().text += GetNextCharacter();
                    m_iCurrentCharElement += 1;
                    m_TTTextTimer.Reset();
                }

                if (m_TTFaceAnimationTimer.TimeUp())
                {
                    ContinueToNextFaceAnimation();
                    m_TTFaceAnimationTimer.Reset();
                }
            }

            // Otherwise Wait Long Enough for the Text to continue
            else
            {
                if (m_SoundFiles.TextSource != null)
                {
                    m_SoundFiles.TextSource.Stop();
                }

                // Close the Mouth of the NPC, (NoMoarTxt4U)
                if (m_eFaceState != FaceState.MOUTH_CLOSED)
                {
                    ContinueToNextFaceAnimation();
                }


                m_TTEndOfTextWaitTimer.Update();

                if (m_TTEndOfTextWaitTimer.TimeUp())
                {
                    m_TTEndOfTextWaitTimer.Reset();
                    m_aTextArray.IncrementElement();
                    ResetTextDisplay();
                }
            }
        }

        // At End of Dialogue
        else
        {
            m_ScrollInfo.Scroll     = true;
            m_ScrollInfo.UpdateText = false;
            m_ScrollInfo.Dir        = ScrollDirection.DOWN;

            if (m_SoundFiles.FlyOutSource != null && m_SoundFiles.FlyOutSource.Length > 0)
            {
                m_SoundFiles.FlyOutSource[Random.Range(0, m_SoundFiles.FlyOutSource.Length)].Play();
            }
        }
    }