private IEnumerator DoVisit(Dictionary <string, string> nameToDialogue, House houseType)
        {
            // Choose the dialogue based on the current combatant
            var combatant = BattleModel.SelectedCombatant;

            if (!nameToDialogue.ContainsKey(combatant.Name))
            {
                throw new ArgumentException("Could not find " + houseType + " visit dialogue for " + combatant.Name);
            }
            var dialogueName = nameToDialogue[combatant.Name];
            var path         = Path.Combine("Chapter 2", dialogueName);

            // Wait for the player to go through the dialogue
            var    dialogueComplete = false;
            Action action           = null;

            action = () => {
                dialogueComplete = true;
                StrangeUtils.RemoveOnceListener(DialogueCompleteSignal, action);
            };
            DialogueCompleteSignal.AddOnce(action);
            StartDialogueSignal.Dispatch(path);
            yield return(new WaitUntil(() => dialogueComplete));

            // Wait for the house light to go off and whatnot.
            var    houseDisabled         = false;
            Action houseDisabledCallback = null;

            houseDisabledCallback = () => {
                houseDisabled = true;
                StrangeUtils.RemoveOnceListener(HouseLightTransitionCompleteSignal, houseDisabledCallback);
            };
            HouseLightTransitionCompleteSignal.AddListener(houseDisabledCallback);
            MarkHouseVisitedSignal.Dispatch(houseType);
            yield return(new WaitUntil(() => houseDisabled));

            Debug.LogFormat("House Visit {0} complete. All done?: {1}", houseType, EastmerePlaza.HouseVisitsComplete);

            // Enable the clinic if the other houses have been visited
            if (EastmerePlaza.HouseVisitsComplete)
            {
                // Wait for the clinic animation to run
                Action clinicEnabledCallback = null;
                var    clinicEnabled         = false;
                clinicEnabledCallback = () => {
                    Debug.Log("Clinic enabled.");
                    clinicEnabled = true;
                    StrangeUtils.RemoveOnceListener(HouseLightTransitionCompleteSignal, clinicEnabledCallback);
                };
                HouseLightTransitionCompleteSignal.AddListener(clinicEnabledCallback);

                Debug.Log("Enabling the clinic.");
                HouseLightEnableSignal.Dispatch(House.Clinic);

                yield return(new WaitUntil(() => clinicEnabled));
            }
        }
示例#2
0
 public override void OnRegister()
 {
     HouseLightEnableSignal.AddListener(OnHouseEnable);
     HouseLightDisableSignal.AddListener(OnHouseDisable);
     View.LightTransitionCompleteSignal.AddListener(LightTransitionCompleteSignal.Dispatch);
 }