예제 #1
0
    IEnumerator IE_StartInteractable()
    {
        scPlayer.ActiveControl(1, false);
        if (playerAnimTime > 0.01f)
        {
            scCam.SetInteractScale(true);
            if (playerAnimKey != "")
            {
                scPlayer.SetAnim(playerAnimKey);
            }
            Vector3 playerPos = scPlayer.transform.position;
            scPlayer.transform.position = new Vector3(transform.position.x + playerXOffset, playerPos.y, playerPos.z);
            yield return(new WaitForSeconds(playerAnimTime));

            scPlayer.SetAnim("idle");
            scCam.SetInteractScale(false);
        }

        if (plotKey != "")
        {
            sc_DialogGod.SetPlotFlag(plotKey, true);
        }

        scPlayer.ActiveControl(1, true);
        yield break;
    }
예제 #2
0
    IEnumerator IE_TalkNpcSequence(string[] array_function)
    {
        char[] funcSpliter = new char[] { '(', ',', ')' };

        foreach (string functionUnit in array_function)
        {
            string[] funcVars = functionUnit.Split(funcSpliter, System.StringSplitOptions.RemoveEmptyEntries);
            switch (funcVars [0])
            {
            case "Move":
                yield return(StartCoroutine(MoveToPos(SplitVectorStr(funcVars[1]))));

                break;

            case "Face":
                if (funcVars [1] == "right" || funcVars[1] == "Right")
                {
                    yield return(StartCoroutine(FaceTarget(true)));
                }
                else if (funcVars [1] == "left" || funcVars[1] == "Left")
                {
                    yield return(StartCoroutine(FaceTarget(false)));
                }
                else
                {
                    Transform faceTarget;
                    if (funcVars [1] == "Player")
                    {
                        faceTarget = playerTR;
                    }
                    else
                    {
                        faceTarget = scDialog.scGod.GetNpcDialog(funcVars [1]).transform;
                    }
                    yield return(StartCoroutine(FaceTarget(faceTarget)));
                }
                break;

            case "BoxSide":
                if (funcVars [1] == "Right")
                {
                    scDialog.isRightBox = true;
                }
                else
                {
                    scDialog.isRightBox = false;
                }
                break;

            case "CheckPlayer":
                if (funcVars.Length == 3)
                {
                    yield return(StartCoroutine(CheckPlayer(funcVars [1], float.Parse(funcVars [2]))));
                }
                break;

            case "Wait":
                yield return(new WaitForSeconds(float.Parse(funcVars [1])));

                break;

            case "Fade":
                yield return(StartCoroutine(FadeSprite(float.Parse(funcVars [1]), float.Parse(funcVars [2]))));

                break;

            case "WaitPos":
                Transform waitTarget;
                if (funcVars [1] == "Player")
                {
                    waitTarget = playerTR;
                }
                else if (funcVars [1] == "Self")
                {
                    waitTarget = transform;
                }
                else
                {
                    waitTarget = scDialog.scGod.GetNpcDialog(funcVars [1]).transform;
                }

                yield return(StartCoroutine(WaitPos(waitTarget, SplitVectorStr(funcVars [2]))));

                break;

            case "Teleport":
                if (funcVars.Length == 3 && funcVars [1] == "Player")
                {
                    Transform    targetTR;
                    sc_character targetSC;
                    if (funcVars [1] == "Player")
                    {
                        targetTR = playerTR;
                        targetSC = scPlayer;
                    }
                    else
                    {
                        sc_NpcDialog tmpDial = scDialog.scGod.GetNpcDialog(funcVars [1]);
                        targetTR = tmpDial.transform;
                        targetSC = tmpDial.scTalk;
                    }
                    Vector2 _tmpVec = SplitVectorStr(funcVars [2]);
                    targetTR.position = new Vector3(_tmpVec.x, _tmpVec.y, targetTR.position.z);
                    targetSC.SnapFloor(1f);
                }
                else
                {
                    Vector2 _tmpVec = SplitVectorStr(funcVars [1]);
                    transform.position = new Vector3(_tmpVec.x, _tmpVec.y, transform.position.z);
                    SnapFloor(1f);
                }

                break;

            case "Talk":
                if (funcVars.Length == 1)
                {
                    scDialog.scGod.StartPlot(funcVars[1]);
                }
                break;

            case "Anim":
                SetAnim(funcVars [1]);
                break;

            case "PlayerAnim":
                scPlayer.SetAnim(funcVars [1]);
                break;

            case "CamAnim":
                sc_God.MainCam.scCam.CamAnim(float.Parse(funcVars [1]), SplitVectorStr(funcVars [2]), float.Parse(funcVars [3]));
                break;

            case "CamFocus":
                sc_God.MainCam.scCam.SetFocusBlack(float.Parse(funcVars [1]), float.Parse(funcVars [2]));
                break;

            case "CamFree":
                sc_God.MainCam.scCam.FreeCamera(bool.Parse(funcVars [1]));
                break;

            case "PlayerControl":
                scPlayer.ActiveControl(int.Parse(funcVars [1]), bool.Parse(funcVars [2]));
                break;

            case "Plot":
                sc_DialogGod.SetPlotFlag(funcVars [1], true);
                break;

            case "PlayerEle":
                scPlayer.DoInteractable();
                break;

            case "SetAlpha":
                SetAlpha(float.Parse(funcVars [1]));
                break;

            case "EnableSprite":
                EnableSprite(bool.Parse(funcVars [1]));
                break;
            }
        }
        yield break;
    }