Exemplo n.º 1
0
        IEnumerator OpenChestRoutine(InteractionUser user)
        {
            // Suspend interactions
            SceneLoader.Instance.currentSceneController.SetBusy();

            // TODO factor out dialogue stuff to some other class

            // HACK this feels dirty
            bool wait = true;

            UnityEngine.Events.UnityAction continueAction = () => wait = false;
            System.Func <bool>             waitP          = () => { return(wait); };

            dialogue.SetTitle("Treasure Chest");
            dialogue.ClearButtons();
            dialogue.AddButton("Next", continueAction);
            dialogue.SetPortrait(treasureImage);
            dialogue.ShowBox();
            if (contents.Count > 0)
            {
                internalGlow.Play();
                animator.SetTrigger("Opening");
                dialogue.SetDialogue("It was full of treasure!");
                yield return(new WaitWhile(waitP));

                wait = true;
                dialogue.SetDialogue("You found:\n" + ContentsText());
                dialogue.ClearButtons();
                dialogue.AddButton("Exit", continueAction);
                dialogue.RebuildLayout();

                // Add items to inventory
                foreach (RPGItems.Item item in contents)
                {
                    GameController.Instance.inventory.Add(Instantiate(item));
                }
                EmptyChest();
                trigger.Triggered = true;
                trigger.Save();

                yield return(new WaitWhile(waitP));
            }
            else
            {
                dialogue.SetDialogue("The chest was empty");
                dialogue.ClearButtons();
                dialogue.AddButton("Exit", continueAction);
                dialogue.RebuildLayout();
                yield return(new WaitWhile(waitP));
            }
            dialogue.ClearButtons();
            dialogue.HideBox();

            SceneLoader.Instance.currentSceneController.ClearBusy();
        }
Exemplo n.º 2
0
 void EndDialogue(InteractionUser user)
 {
     dialogue.ClearButtons();
     dialogue.HideBox();
     SceneLoader.Instance.currentSceneController.ClearBusy();
 }