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()); } }
public override void Interact(InteractionUser user) { // Assign Speakers to my dialogue actors dialogueManager.actors["Barricade"] = actor; dialogueManager.actors["BarricadeGuard"] = guard.actor; dialogueManager.StartConversation(conversation); }
// 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; }
private void OnTriggerExit(Collider other) { InteractionUser user = other.GetComponent <InteractionUser>(); if (user != null) { user.Unselect(this); } }
private void OnTriggerEnter(Collider other) { InteractionUser user = other.GetComponent <InteractionUser>(); if (user != null && IsFacingMe(other.transform)) { user.Select(this); } }
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(); }
private void OnTriggerStay(Collider other) { InteractionUser user = other.GetComponent <InteractionUser>(); if (user != null) { if (IsFacingMe(other.transform)) { user.Select(this); } else { user.Unselect(this); } } }
// TODO saving treasure chest public override void Interact(InteractionUser user) { StartCoroutine(OpenChestRoutine(user)); }
public override void Interact(InteractionUser user) { SceneLoader.Instance.SetEntryPoint(bossEntrypointIndex); dialogueManager.StartConversation(conversation); }
public abstract void Interact(InteractionUser user);
public override void Interact(InteractionUser user) { SceneLoader.Instance.LoadScene(dungeonScene, entryPoint); // TODO maybe make routine with effects, animation, etc }
public override void Interact(InteractionUser user) { StartCoroutine(TryBreakRoadblockRoutine(user)); }
void EndDialogue(InteractionUser user) { dialogue.ClearButtons(); dialogue.HideBox(); SceneLoader.Instance.currentSceneController.ClearBusy(); }