Example #1
0
 IEnumerator ShowNextTalk()
 {
     isTalking = true;
     while (true)
     {
         if (isPlayerTalk)
         {
             NPCTalkPanel.SetActive(false);
             playerTalkPanel.SetActive(true);
             playerTalkText.text = GetTalk(nextScript, stringIndex);
         }
         else
         {
             NPCTalkPanel.SetActive(true);
             playerTalkPanel.SetActive(false);
             NPCTalkText.text = GetTalk(nextScript, stringIndex);
         }
         yield return(null);
     }
 }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (nextScript == 1004)
        {
            LOADING.changeGameScene("MainScene");
        }
        if (nextScript == 1003)
        {
            isPlayerTalk = false;
            NPCTalkPanel.transform.GetChild(2).gameObject.SetActive(false);
            StartCoroutine("ShowNextTalk");
        }
        NPCTalkPanel.transform.GetChild(2).gameObject.SetActive(false);
        if (nextScript == 1002 && !isTalking)
        {
            if (isWait)
            {
                StartCoroutine("ShowNextTalk");
            }
        }

        if (nextScript == 1002)
        {
            if (!BGM.isPlaying && !heroNeverdie)
            {
                BGM.clip = Resources.Load("talkScript/mercy") as AudioClip;
                BGM.Play();
                heroNeverdie = true;
            }

            if (stringIndex == 5)
            {
                thirdBackGround.gameObject.SetActive(true);
                firstBackground.gameObject.SetActive(false);
            }
            if (stringIndex % 2 == 1)
            {
                isPlayerTalk = true;
                NPCTalkPanel.transform.GetChild(2).gameObject.SetActive(false);
            }
            else
            {
                isPlayerTalk = false;
                NPCTalkPanel.transform.GetChild(2).gameObject.SetActive(true);
            }
        }
        if (nextScript != 1001)
        {
            NPCTalkPanel.transform.GetChild(1).gameObject.SetActive(false);
        }
        if (nextScript == 1001 && stringIndex % 2 == 0)
        {
            isPlayerTalk = true;
        }
        else if (nextScript == 1001 && stringIndex % 2 == 1)
        {
            NPCTalkPanel.transform.GetChild(1).gameObject.SetActive(true);
            isPlayerTalk = false;
        }
        if (Input.GetMouseButtonUp(0))
        {
            if (!isAfterDone && isTalking)
            {
                stringIndex++;
            }
            else
            {
                if (!isTalking)
                {
                    after1000Year.gameObject.SetActive(false);
                    isTalking = true;
                    gameObject.GetComponent <talkManager>().firstBackground.gameObject.SetActive(false);
                    gameObject.GetComponent <talkManager>().secondBackground.gameObject.SetActive(true);
                }
                else
                {
                    stringIndex++;
                }
            }
        }
        if (stringIndex >= talkData[nextScript].Length)
        {
            NPCTalkPanel.SetActive(false);
            playerTalkPanel.SetActive(false);
            nextScript++;
            if (nextScript == 1002)
            {
                BGM.clip = Resources.Load("talkScript/Punch") as AudioClip;
                BGM.Play();

                firstBackground.gameObject.SetActive(true);
                secondBackground.gameObject.SetActive(false);
                StartCoroutine(timeWait(1.0f));
            }
            StopCoroutine("ShowNextTalk");
            isTalking   = false;
            stringIndex = 0;
            if (nextScript == 1001 && !isAfterDone)
            {
                isTalking = false;
                after1000Year.gameObject.SetActive(true);
                StopCoroutine("ShowNextTalk");
                StartCoroutine(FadeInText(0.1f));
            }
        }
    }
Example #3
0
 void Start()
 {
     NPCTalkPanel.SetActive(true);
     afterTextColor       = after1000Year.color;
     firstBackgroundColor = firstBackground.color;
 }