IEnumerator EventCoroutine()
    {
        theOrder.NotMove();

        if (theNumber.GetResult())
        {
            theDM.ShowDialogue(dialogue_0);
        }
        else
        {
            theDM.ShowDialogue(dialogue_1);
            theNumber.ShowNumber(correctNumber);
            yield return(new WaitUntil(() => !theNumber.activated));

            if (theNumber.GetResult())
            {
                event3.changeClock();
                newClock.SetActive(true);
            }
        }



        yield return(new WaitUntil(() => !theDM.talking));

        theOrder.Move();
        flag = false;
    }
Example #2
0
    private void OnTriggerStay2D(Collider2D collision){

        if (Input.GetKeyDown(KeyCode.W))
        {
            // 정답을 맞추지 못했었다면 비밀번호창 실행
            if( !TheNumber.GetResult() ){
                rigid.constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezePositionY | RigidbodyConstraints2D.FreezeRotation;
                StartCoroutine(ACoroutine());
            }
        }
    }
Example #3
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        theNum   = FindObjectOfType <NumberSystem>();
        theAudio = FindObjectOfType <AudioManager>();//추가

        if (theNum.GetResult())
        {
            go.SetActive(true);
            theAudio.Play(endingSong);//추가
        }
    }
Example #4
0
    IEnumerator ACoroutine()
    {
        flag = true;
        theOrder.NotMove();

        theDM.ShowDialogue(dialogue_0);
        theNumber.ShowNumber(correctNumber);

        yield return(new WaitUntil(() => !theNumber.activated));


        if (!theNumber.GetResult())
        {
            flag = false;
        }
        else
        {
            event2.canExitChange();
        }

        yield return(new WaitUntil(() => !theDM.talking));

        theOrder.Move();
    }
Example #5
0
    protected override IEnumerator EventCoroutine()
    {
        flag = true;

        StartDialogue(dialogs[1]);
        yield return(new WaitUntil(() => !IsExcuting()));

        theNS.ShowNumber(combi);
        yield return(new WaitUntil(() => !theNS.activated));

        flag = theNS.GetResult();
        if (flag)
        {
            theSR.sprite = sprites[1];
            GetItem(20101);
            GetItem(20201);
            GetItem(20301);
            GetItem(20401);
            StartDialogue(dialogs[0]);
            yield return(new WaitUntil(() => !IsExcuting()));
        }

        ExitEvent();
    }
Example #6
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        if (collision.gameObject.name == "Portal32" && Input.GetKey(KeyCode.S))
        {
            Debug.Log(TAG + "portal");
            Scene3.SetActive(false);
            Scene2.SetActive(true);
            player.PlayerReposition(new Vector2(3.2f, -9.7f));
        }

        if (Input.GetKeyDown(KeyCode.W))
        {
            switch (collision.gameObject.name)
            {
            case "벽난로":
                Debug.Log(TAG + "벽난로");
                if (PlayerMove.stuffName == "장작")
                {
                    Debug.Log(TAG + "장작");

                    manager.Action(collision.gameObject);
                    Dark.SetActive(false);
                    Portal_cancel.SetActive(false);
                    // 말풍선 떠있으면 Freeze
                    if (manager.isActive)
                    {
                        rigid.constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezePositionY | RigidbodyConstraints2D.FreezeRotation;
                    }
                    else
                    {
                        // 대화 끝
                        rigid.constraints = RigidbodyConstraints2D.FreezeRotation;
                        collision.gameObject.SetActive(false);
                    }
                }
                break;


            case "액자_1":
                Debug.Log(TAG + "액자_1");

                manager.Action(collision.gameObject);

                if (manager.isActive)
                {
                    rigid.constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezePositionY | RigidbodyConstraints2D.FreezeRotation;
                }
                else
                {
                    // 대화 끝
                    rigid.constraints = RigidbodyConstraints2D.FreezeRotation;
                    Item newItem = itemManager.GetWordItem(collision.gameObject.GetComponent <ObjectData>().id);
                    if (newItem != null)
                    {
                        Debug.Log("get newItem: " + newItem.itemName);
                        rigid.GetComponent <Inventory>().AddItem(newItem);
                    }
                    collision.gameObject.SetActive(false);
                }
                break;

            case "캔버스":
                Debug.Log(TAG + "캔버스");
                if (PlayerMove.stuffName == "우산")
                {
                    manager.Action(collision.gameObject);

                    if (manager.isActive)
                    {
                        rigid.constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezePositionY | RigidbodyConstraints2D.FreezeRotation;
                    }
                    else
                    {
                        // 대화 끝
                        rigid.constraints = RigidbodyConstraints2D.FreezeRotation;
                        Item newItem = itemManager.GetWordItem(collision.gameObject.GetComponent <ObjectData>().id);
                        if (newItem != null)
                        {
                            Debug.Log("get newItem: " + newItem.itemName);
                            rigid.GetComponent <Inventory>().AddItem(newItem);
                        }

                        collision.gameObject.SetActive(false);
                    }
                }
                break;


            case "벽난로_불":
                Debug.Log(TAG + "벽난로");
                if (PlayerMove.stuffName == "편지")
                {
                    Debug.Log("Finish!");
                    Time.timeScale = 0;

                    FinishScreen.SetActive(true);
                }
                break;

            case "편지함":
                Debug.Log(TAG + "편지함");

                if (PlayerMove.stuffName == "가위")
                {
                    manager.Action(collision.gameObject);

                    if (manager.isActive)
                    {
                        rigid.constraints = RigidbodyConstraints2D.FreezePositionX |
                                            RigidbodyConstraints2D.FreezePositionY |
                                            RigidbodyConstraints2D.FreezeRotation;
                    }
                    else
                    {
                        // 대화 끝
                        rigid.constraints = RigidbodyConstraints2D.FreezeRotation;
                        Item newItem = itemManager.GetWordItem(collision.gameObject.GetComponent <ObjectData>().id);
                        if (newItem != null)
                        {
                            Debug.Log("get newItem: " + newItem.itemName);
                            rigid.GetComponent <Inventory>().AddItem(newItem);
                        }
                    }
                }
                break;

            case "달력":
                // 정답을 맞추지 못했었다면 비밀번호창 실행
                if (!TheNumber.GetResult() && isNumberActive == false)
                {
                    manager.Action(collision.gameObject);
                    if (manager.isActive)
                    {
                        rigid.constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezePositionY | RigidbodyConstraints2D.FreezeRotation;
                    }
                    else
                    {
                        rigid.constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezePositionY | RigidbodyConstraints2D.FreezeRotation;
                        StartCoroutine(ACoroutine());
                        isNumberActive = true;
                    }
                }
                break;
            }
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (collision.gameObject.name == "달력")
            {
                rigid.constraints = RigidbodyConstraints2D.FreezeRotation;
                isNumberActive    = false;
            }
        }
        else if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (collision.gameObject.name == "달력")
            {
                rigid.constraints = RigidbodyConstraints2D.FreezeRotation;
                isNumberActive    = false;
            }
        }

        if (TheNumber.GetResult())
        {
            Item newItem = itemManager.GetWordItem(collision.gameObject.GetComponent <ObjectData>().id);
            if (newItem != null)
            {
                Debug.Log("get newItem: " + newItem.itemName);
                rigid.GetComponent <Inventory>().AddItem(newItem);
            }
        }
    }