Exemple #1
0
    //Execute given text commands for dialogue
    void ExecuteTxtCommand(string[] command)
    {
        switch (command[0])
        {
        //Set portrait images
        case ("LPort"): LoadPortraitImage(leftPortrait, command[1]);
            break;

        case ("RPort"): LoadPortraitImage(rightPortrait, command[1]);
            break;

        //SET NAME TAGS
        case ("LName"):
            leftNameTag.SetActive(true);
            leftNameTag.transform.GetChild(0).GetComponent <Text>().text = command[1];
            if (command[1] == "None")
            {
                leftNameTag.SetActive(false);
            }
            break;

        case ("RName"):
            rightNameTag.SetActive(true);
            rightNameTag.transform.GetChild(0).GetComponent <Text>().text = command[1];
            if (command[1] == "None")
            {
                rightNameTag.SetActive(false);
            }
            break;

        //Set speaking state. Fade out color if not speaking. Otherwise brighten/stay normal color if speaking
        case ("LSpeaking"):
            if (command[1] == "T")
            {
                setCharSpeaker(leftPortrait, leftNameTag);
                if (command[1] == "None")
                {
                    leftNameTag.SetActive(false);
                }
            }
            else
            {
                setCharListener(leftPortrait, leftNameTag);
            }
            break;

        case ("RSpeaking"):
            if (command[1] == "T")
            {
                setCharSpeaker(rightPortrait, rightNameTag);
                if (command[1] == "None")
                {
                    rightNameTag.SetActive(false);
                }
            }
            else
            {
                setCharListener(rightPortrait, rightNameTag);
            }
            break;

        case ("Music"):
            if (command[1] == "NextLayer")
            {
                musicManager.ActivateNextClip();
            }
            break;

        case ("CamShake"):
            float shakeAmt = .01f;
            float.TryParse(command[1], out shakeAmt);
            shakeAmt *= .01f;
            shakeScript.StartShake(shakeAmt);

            break;

        //Clear out character information in dialogue
        case ("Clear"): Clear();
            break;

        default: break;
        }
    }