コード例 #1
0
    void Update()
    {
        if (currentLine < scenarios.Count && Input.GetMouseButtonDown(0))
        {
            SetNextLine();
        }

        //Tutorial Action
        if (!actOnFlg)
        {
            if (currentLine == scenarios.Count)
            {
                TutorialController tutorialScript = new TutorialController();
                tutorialScript.ActTutorial(tutorialId);
                actOnFlg = true;
            }
            if (tutorialId == 5 && currentLine == 1)
            {
                if (!gunzeiOnFlg)
                {
                    AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource>();
                    audioSources[9].Play();
                    GameObject Gunzei = SetGunzei();
                    gunzeiOnFlg = true;
                }
            }
            if (tutorialId == 10)
            {
                //busyo
                TutorialController tutorialScript = new TutorialController();
                Color enabledColor  = new Color(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
                Color disabledColor = new Color(50f / 255f, 50f / 255f, 50f / 255f, 255f / 255f);

                if (currentLine == 1)
                {
                    GameObject tBack       = GameObject.Find("tBack").gameObject;
                    GameObject BusyoStatus = GameObject.Find("BusyoStatus").gameObject;
                    BusyoStatus.transform.FindChild("StatusLv").transform.SetParent(tBack.transform);
                    BusyoStatus.transform.FindChild("StatusTosotsu").transform.SetParent(tBack.transform);
                    BusyoStatus.transform.FindChild("StatusBuyuu").transform.SetParent(tBack.transform);
                    BusyoStatus.transform.FindChild("StatusChiryaku").transform.SetParent(tBack.transform);
                    BusyoStatus.transform.FindChild("StatusSpeed").transform.SetParent(tBack.transform);
                    actOnFlg = true;
                }
                else if (currentLine == 5)
                {
                    GameObject tBack       = GameObject.Find("tBack").gameObject;
                    GameObject BusyoStatus = GameObject.Find("BusyoStatus").gameObject;
                    tBack.transform.FindChild("StatusLv").transform.SetParent(BusyoStatus.transform);
                    tBack.transform.FindChild("StatusTosotsu").transform.SetParent(BusyoStatus.transform);
                    tBack.transform.FindChild("StatusBuyuu").transform.SetParent(BusyoStatus.transform);
                    tBack.transform.FindChild("StatusChiryaku").transform.SetParent(BusyoStatus.transform);
                    tBack.transform.FindChild("StatusSpeed").transform.SetParent(BusyoStatus.transform);
                    GameObject.Find("ButaiStatus").transform.SetParent(tBack.transform);
                    GameObject btn1 = GameObject.Find("ButtonCyouhei").gameObject;
                    GameObject btn2 = GameObject.Find("ButtonKunren").gameObject;
                    btn1.GetComponent <Button>().enabled = false;
                    btn2.GetComponent <Button>().enabled = false;
                    btn1.GetComponent <Image>().color    = disabledColor;
                    btn2.GetComponent <Image>().color    = disabledColor;
                    btn1.transform.FindChild("Text").GetComponent <Text>().color = disabledColor;
                    btn2.transform.FindChild("Text").GetComponent <Text>().color = disabledColor;

                    actOnFlg = true;
                }
                else if (currentLine == 7)
                {
                    GameObject btn = GameObject.Find("ButtonCyouhei").gameObject;
                    btn.GetComponent <Button>().enabled = true;
                    Vector2    vect    = new Vector2(0, 50);
                    GameObject animObj = tutorialScript.SetPointer(btn, vect);
                    animObj.transform.localScale = new Vector2(100, 100);

                    btn.GetComponent <Button>().enabled = true;
                    btn.GetComponent <Image>().color    = enabledColor;
                    btn.transform.FindChild("Text").GetComponent <Text>().color = enabledColor;
                    actOnFlg = true;
                }
            }

            if (tutorialId == 15)
            {
                if (currentLine == 3)
                {
                    TutorialController tutorialScript = new TutorialController();
                    Vector2            vect           = new Vector2(0, 0);
                    Vector2            size1          = new Vector2(60, 60);
                    Vector2            size2          = new Vector2(150, 150);
                    tutorialScript.SetDoublePointer(GameObject.Find("Video").gameObject, GameObject.Find("MainButtonView").transform.FindChild("Syounin").gameObject, vect, vect, size1, size2);
                    actOnFlg = true;
                }
                else if (currentLine == 5)
                {
                    TutorialController tutorialScript = new TutorialController();
                    GameObject         btn            = GameObject.Find("PvP").gameObject;
                    Vector2            vect           = new Vector2(0, 50);
                    GameObject         animObj        = tutorialScript.SetFadeoutPointer(btn, vect);
                    animObj.transform.localScale = new Vector2(200, 200);
                    actOnFlg = true;
                }
            }
        }
        else
        {
            if (tutorialId == 10)
            {
                if (currentLine == 4)
                {
                    actOnFlg = false;
                }
                else if (currentLine == 6)
                {
                    actOnFlg = false;
                }
            }

            if (tutorialId == 15)
            {
                if (currentLine == 0 || currentLine == 4 || currentLine == 6)
                {
                    actOnFlg = false;
                }
            }
            if (tutorialId == 16 && !doneFlg)
            {
                actOnFlg = false;
                doneFlg  = true;
            }
        }


        // クリックから経過した時間が想定表示時間の何%か確認し、表示文字数を出す
        int displayCharacterCount = (int)(Mathf.Clamp01((Time.time - timeElapsed) / timeUntilDisplay) * currentText.Length);

        // 表示文字数が前回の表示文字数と異なるならテキストを更新する
        if (displayCharacterCount != lastUpdateCharacter)
        {
            uiText.text         = currentText.Substring(0, displayCharacterCount);
            lastUpdateCharacter = displayCharacterCount;
        }
    }