示例#1
0
    private IEnumerator OpenDoor()
    {
        MessageWindow messageWindow = MessageSystem.GetWindow();
        bool          hasItem       = InventorySystem.HasItem(keyItem);

        if (!hasItem)
        {
            yield return(StartCoroutine(messageWindow.ShowClick("ドアを開けるには鍵が必要なようだ")));

            messageWindow.Close();
        }
        else
        {
            yield return(StartCoroutine(messageWindow.ShowClick("ガチャ! ドアの鍵を開けた")));

            messageWindow.Close();

            //ドアを開ける
            door.SetActive(false);

            //イベントが起動しないようにする
            triggerColider.enabled = false;

            //鍵を消費する
            InventorySystem.Remove(keyItem);

            //フラグの保存
            VariablePersister.SetBool(key, true);
        }
        yield return(null);
    }
示例#2
0
    public IEnumerator Switching()
    {
        MessageWindow messageWindow = MessageSystem.GetWindow();

        InteractableStart();

        //スイッチがオンのときオフに切り替える
        //Switch off when switch is on
        if (isOnSwitch)
        {
            isOnSwitch            = false;
            spriteRenderer.sprite = offImage;
            OffSwitch.Invoke();

            yield return(new WaitForSeconds(wait));

            yield return(StartCoroutine(messageWindow.ShowClick(offMessage)));
        }
        else
        {
            isOnSwitch            = true;
            spriteRenderer.sprite = onImage;
            OnSwitch.Invoke();

            yield return(new WaitForSeconds(wait));

            yield return(StartCoroutine(messageWindow.ShowClick(onMessage)));
        }

        messageWindow.Close();
        InteractableEnd();
        yield break;
    }
示例#3
0
    public IEnumerator OpenBox()
    {
        MessageWindow messageWindow = MessageSystem.GetWindow();

        InteractableStart();

        if (ItemExists())
        {
            yield return(StartCoroutine(messageWindow.ShowClick("からっぽだ")));

            messageWindow.Close();
            InteractableEnd();
            yield break;
        }

        isObtain = true;
        SpriteRenderer spriteRenderer = GetComponent <SpriteRenderer>();

        spriteRenderer.sprite = enptyImage;
        GameController.GetInventorySystem().AddItem(item);
        string ms = item.itemName + "を手に入れた";

        yield return(StartCoroutine(MessageSystem.GetWindow().ShowClick(ms)));

        messageWindow.Close();



        InteractableEnd();
        yield break;
    }
示例#4
0
    public IEnumerator PicUp(string itemName)
    {
        if (isOpen)
        {
            yield break;
        }
        isOpen = true;
        MessageWindow  messageWindow  = MessageSystem.GetWindow();
        SpriteRenderer spriteRenderer = GetComponent <SpriteRenderer>();

        spriteRenderer.sprite = enptyImage;
        string ms = itemName + "を手に入れた";

        yield return(StartCoroutine(MessageSystem.GetWindow().ShowClick(ms)));

        messageWindow.Close();
        yield break;
    }
示例#5
0
文件: Inn.cs 项目: bmjoy/Unity2DRPG
    public IEnumerator Talk()
    {
        MessageWindow messageWindow = MessageSystem.GetWindow();
        ChoiceWindow  choiceWindow  = MessageSystem.GetChoise();

        InteractableStart();

        yield return(StartCoroutine(messageWindow.ShowClick("ひと晩" + roomCharge + "ゴールドですが\nおとまりになられますか")));

        yield return(StartCoroutine(choiceWindow.Choice()));

        int choiceResult = choiceWindow.Result();

        if (choiceResult == 1)
        {
            if (GameController.Instance.money <= 0)
            {
                yield return(StartCoroutine(messageWindow.ShowClick("お金が たりないようです")));

                messageWindow.Close();
                InteractableEnd();
                yield break;
            }

            yield return(StartCoroutine(messageWindow.ShowClick("それでは ごゆっくり おやすみください")));

            GameController.Instance.money -= roomCharge;
            Stay();
            yield return(StartCoroutine(SceneFader.FadeSceneOut()));

            yield return(StartCoroutine(SceneFader.FadeSceneIn()));

            yield return(StartCoroutine(messageWindow.ShowClick("おはようございます。ではいってらっしゃいませ")));
        }
        else
        {
            yield return(StartCoroutine(messageWindow.ShowClick("お気をつけて 旅をつづけられますように")));
        }

        messageWindow.Close();

        InteractableEnd();
        yield break;
    }
示例#6
0
文件: NPC.cs 项目: bmjoy/Unity2DRPG
    public IEnumerator Talk()
    {
        MessageWindow messageWindow = MessageSystem.GetWindow();
        Conversation  conversation  = GetComponent <Conversation>();

        InteractableStart();

        //会話文章の表示
        //display talk
        List <string> content = conversation.conversation;

        foreach (var item in content)
        {
            yield return(StartCoroutine(messageWindow.ShowClick(item)));
        }
        messageWindow.Close();

        InteractableEnd();
    }
示例#7
0
    public IEnumerator Shopping()
    {
        MessageWindow messageWindow = MessageSystem.GetWindow();

        yield return(StartCoroutine(messageWindow.ShowClick("いらしゃいませ")));

        messageWindow.Close();

        var m_shop = Instantiate(shop);

        m_shop.product = items;
        m_shop.Open();
        yield return(new WaitUntil(() => m_shop.isOpen == false));

        yield return(StartCoroutine(messageWindow.ShowClick("またのおこしを")));

        messageWindow.Close();
        yield break;
    }
示例#8
0
    public IEnumerator OpenBox()
    {
        MessageWindow messageWindow = MessageSystem.GetWindow();

        PlayerInteract.InteractableStart();

        if (isOpen)
        {
            yield return(StartCoroutine(messageWindow.ShowClick("からっぽだ")));

            messageWindow.Close();
            PlayerInteract.InteractableEnd();
            yield break;
        }

        //お金が入っていた
        if (money > 0)
        {
            yield return(GetMony());
        }

        //アイテムが入っていた
        if (item != null)
        {
            yield return(GetItem());
        }

        //装備が入っていた
        if (equipment != null)
        {
            yield return(GetEqip());
        }

        //フラグの保存
        VariablePersister.SetBool(key, true);

        PlayerInteract.InteractableEnd();
        yield break;
    }
    public IEnumerator Talk()
    {
        MessageWindow messageWindow = MessageSystem.GetWindow();

        PlayerInteract.InteractableStart();

        //会話文章の表示
        //display talk
        List <string> content = conversation;

        foreach (var item in content)
        {
            yield return(new WaitForEndOfFrame());

            yield return(StartCoroutine(messageWindow.ShowClick(item)));

            yield return(new WaitForEndOfFrame());
        }
        messageWindow.Close();

        PlayerInteract.InteractableEnd();
    }