예제 #1
0
        IEnumerator TryBreakRoadblockRoutine(InteractionUser user)
        {
            SceneLoader.Instance.currentSceneController.SetBusy();
            // HACK this feels dirty
            bool wait = true;

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

            dialogue.SetTitle("Roadblock");
            dialogue.ClearButtons();
            dialogue.AddButton("Next", continueAction);
            dialogue.SetPortrait(roadblockImage);
            dialogue.ShowBox();
            dialogue.SetDialogue("A pile of objects blocks your path out of the town");
            yield return(new WaitWhile(waitP));

            wait = true;
            // HACK for testing
            if (forceAllow)
            {
                dialogue.SetDialogue("Your party breaks down the roadblock");
                yield return(new WaitWhile(waitP));

                trigger.enabled = false;
                EndDialogue(user);
                yield return(RoadblockFallRoutine());
            }
            else
            if (!(SceneLoader.Instance.CheckBool("06 Barracks_Interior", "knight_battle")))
            {
                dialogue.SetDialogue("You need a strong knight to move these objects!");
                yield return(new WaitWhile(waitP));

                EndDialogue(user);
            }
            else if (!(SceneLoader.Instance.CheckBool("04 Town", "rogue_battle")))
            {
                dialogue.SetDialogue("You need an expert in breaking and entering for this job.");
                yield return(new WaitWhile(waitP));

                EndDialogue(user);
            }
            else if (!(SceneLoader.Instance.CheckBool("05 Tavern_Interior", "bard_battle")))
            {
                dialogue.SetDialogue("You can't work without musical accompaniment!");
                yield return(new WaitWhile(waitP));

                EndDialogue(user);
            }
            else
            {
                dialogue.SetDialogue("Your party breaks down the roadblock");
                yield return(new WaitWhile(waitP));

                trigger.enabled = false;
                EndDialogue(user);
                yield return(RoadblockFallRoutine());
            }
        }
예제 #2
0
 public override void Interact(InteractionUser user)
 {
     // Assign Speakers to my dialogue actors
     dialogueManager.actors["Barricade"]      = actor;
     dialogueManager.actors["BarricadeGuard"] = guard.actor;
     dialogueManager.StartConversation(conversation);
 }
예제 #3
0
    // TODO events for moving or not moving?

    // Use this for initialization
    void Start()
    {
        characterController = GetComponent <CharacterController>();
        interactionUser     = GetComponent <RPG.InteractionUser>();
        anim    = GetComponent <Animator>();
        moveDir = Vector3.zero;
    }
예제 #4
0
        private void OnTriggerExit(Collider other)
        {
            InteractionUser user = other.GetComponent <InteractionUser>();

            if (user != null)
            {
                user.Unselect(this);
            }
        }
예제 #5
0
        private void OnTriggerEnter(Collider other)
        {
            InteractionUser user = other.GetComponent <InteractionUser>();

            if (user != null && IsFacingMe(other.transform))
            {
                user.Select(this);
            }
        }
예제 #6
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();
        }
예제 #7
0
        private void OnTriggerStay(Collider other)
        {
            InteractionUser user = other.GetComponent <InteractionUser>();

            if (user != null)
            {
                if (IsFacingMe(other.transform))
                {
                    user.Select(this);
                }
                else
                {
                    user.Unselect(this);
                }
            }
        }
예제 #8
0
 // TODO saving treasure chest
 public override void Interact(InteractionUser user)
 {
     StartCoroutine(OpenChestRoutine(user));
 }
예제 #9
0
 public override void Interact(InteractionUser user)
 {
     SceneLoader.Instance.SetEntryPoint(bossEntrypointIndex);
     dialogueManager.StartConversation(conversation);
 }
예제 #10
0
 public abstract void Interact(InteractionUser user);
예제 #11
0
 public override void Interact(InteractionUser user)
 {
     SceneLoader.Instance.LoadScene(dungeonScene, entryPoint);
     // TODO maybe make routine with effects, animation, etc
 }
예제 #12
0
 public override void Interact(InteractionUser user)
 {
     StartCoroutine(TryBreakRoadblockRoutine(user));
 }
예제 #13
0
 void EndDialogue(InteractionUser user)
 {
     dialogue.ClearButtons();
     dialogue.HideBox();
     SceneLoader.Instance.currentSceneController.ClearBusy();
 }