/*********************************************************************** * С Ю Ж Е Т ***********************************************************************/ public virtual void StoryRun(int flag, FormList form) // вызывается из формы через переопр. ф-ию { StoryMode mode = (StoryMode)flag; // всякие проверки, потом вызываем рассказчика сюжета с подборкой эпизодов PrepareStory(); if (mode == StoryMode.tutor && PrepareTutorials(form)) // прогоняем туториалку { Storyteller(mode, () => { ShowForm(form, 0); }); } // это вызывается из формы ShowCounsilForm if (mode == StoryMode.counsil) // нужно промотать время { PrepareCounsil(); // Storyteller ( mode, () => { WeeklyUpdate (); main (); }); Storyteller(mode, () => { WeeklyUpdate(); ShowPrivate(); }); // оттуда попадаем в мейн } // оттуда же else if (mode == StoryMode.stranger || mode == StoryMode.audience) { PrepareAudiences(); Storyteller(mode, () => { ShowCounsil(); }); } // это может быть вызвано из ShowMainForm, но не только else if (mode == StoryMode.events && PrepareEvents(form)) { Storyteller(mode, () => { ShowForm(form, 0); }); } // потом всякие действия по перемотке времени - апдейт страны и т.д. // чистим и обновляем историю }
// здесь формируем список диалогов для текущей сессии и запускаем цепочку исполнения private Action Storyteller(StoryMode mode, Action onComplete) { SubStory sub1; Dialogue dial1; List <Dialogue> dialist = new List <Dialogue>(); // в цикле перебираем сюжетные линии; пока всего одна + отдельные для аудиенций и совета for (int i = 0; i < Sujet.count; i++) { if ((sub1 = Sujet.Seq_GetOne(i)) != null) { Debug.Log("нашли " + sub1.SubName + " " + sub1.index); // для подсюжета смотрим следующий диалог, повествование линейное, в будущем надо сделать // дерево диалогов в подсюжете; диалогам надо добавлять стартовые условия if (GetSubStoryCategory(sub1) == mode && (dial1 = sub1.Sub_NextDialogue()) != null) { dialist.Add(dial1); // добавляем диалог в текущий набор рассказчика Debug.Log("добавили " + sub1.SubName + " " + sub1.index); // из каждой сюжетки взяли один диалог } } } Sujet.Seq_ClearFinished(); Output.SetScene(); // пока пустая // чтобы не зациклилась, стопарим, если нет диалогов if (dialist.Count > 0) { // запускаем выполнение всех выбранных диалогов return(DialogueRoutine(dialist, onComplete)); } else { return(onComplete); } }
private void startTargetPrologue(Story.TargetCharacter targetCharacter) { string path = string.Format("{0}{1}", targetCharacter.ScenarioDirPath, RsrcLoader.PROLOGUE_FILENAME); StoryMode.LoadScenario(path); StoryMode.ScenarioEndEvent.Attach(onTargetPrologueEnd); }
/// <summary> /// GenerateStory(): /// Create the story filling in the blanks using the user's stored answers. /// /// Arguments: /// -Depending on the mode chosen will determine which story template is used. /// -A list containing the users inputs to be used to fill the blanks. /// /// Steps: /// -Use List to replace the blanks in the template /// -Return the full string. /// </summary> private string GenerateStory(StoryMode storyMode, List <string> storedInputs) { string temp; switch (storyMode) { case StoryMode.General: return(temp = $"\nI just got back from a pizza party with {storedInputs[9]} " + $"\nCan you believe we got to eat {storedInputs[1]} pizza in {storedInputs[6]}." + $"\nEveryone got to choose their own toppings. I made '{storedInputs[7]} and {storedInputs[0]}' pizza, which is my favorite!" + $"\nThey even stuffed the crust with {storedInputs[8]}. How {storedInputs[4]}." + $"\nIf that wasn't good enough already, {storedInputs[3]} was there singing {storedInputs[2]}. " + $"\nI was so inspired by the music, I had to get up out of my seat and {storedInputs[5]}."); case StoryMode.PG: return(temp = $"\nYou know you've made it when {storedInputs[6]} wants to shut you down." + $"\nSo here are five {storedInputs[4]} tips I took from my days as a {storedInputs[2]} to get to where I am." + $"\nOne. If the other {storedInputs[0]} jumped off the {storedInputs[10]}, do it better." + $"\nTwo. Always wear {storedInputs[5]} underwear in case you're in {storedInputs[8]}." + $"\nThree. When you get to my age, make sure you have {storedInputs[11]} at least once." + $"\nFour. Remember, turning on the {storedInputs[1]} is illegal, unless you're {storedInputs[9]}" + $"\nAnd five. Don't let other people {storedInputs[7]} your {storedInputs[3]}, do it yourself."); default: return(temp = "Error generating story."); } }
/********** Prologue **********/ private void startPrologue() { string path = string.Format("{0}{1}{2}", RsrcLoader.SCENARIO_FOLDER_PATH, RsrcLoader.DIR_SEPARATOR, RsrcLoader.PROLOGUE_FILENAME); StoryMode.LoadScenario(path); StoryMode.ScenarioEndEvent.Attach(onPrologueEnd); }
private void startNextScenario() { Story.TargetCharacter target = StoryMode.TargetCharacter; bool isLoaded = StoryMode.LoadScenario(target.NextScenarioPath); if (false == isLoaded) { return; } }
/// <summary> /// GameSetUp(): /// Set up the game for new round. /// /// Steps: /// -Clear list for new inputs /// -Ask user to pick a story mode. /// </summary> public void GameSetUp() { Console.Clear(); //Clear list of stored inputs for new round if (storedUserInput.Count > 0) { storedUserInput.Clear(); } //Get user to pick from the 2 stories selectedStory = SelectStory(); Console.Clear(); }
// public void EndStory() { string path = StoryMode.GetEndingScenarioPath(MainCharacter); Log.Debug(string.Format("story.ending path: {0}", path)); bool isLoaded = StoryMode.LoadScenario(path); if (isLoaded) { // @warn : callback's calling order StoryMode.ScenarioEndEvent.Attach(onStoryEndingScenarioEnd); } }
public void CreateTargetCharacter(int targetId) { if (false == ExtTarget.isValid(targetId)) { Log.Error(string.Format("invalid target id; {0}", targetId)); return; } CustomPlayerPrefs.SetInt(PlayerPrefsKey.TARGET, targetId); Story.TargetCharacter tc = loadTargetCharacter(); StoryMode.Set(tc); startTargetPrologue(tc); }
/********** Ending **********/ public void EndNurture() { _nurtureEndingId = NurtureMode.GetEndingId(); if (false == ExtNurtureEnding.isValid(_nurtureEndingId)) { Log.Error(string.Format("invalid nurture.ending id; {0}", _nurtureEndingId)); return; } NurtureEnding ending = Manager.Instance.DT.NurtureEnding[_nurtureEndingId]; Log.Debug(string.Format("nurture.ending id({0}), name({1})", _nurtureEndingId, ending.name)); TextAsset nurtureEndingScenario = ending.scenario; bool isLoaded = StoryMode.LoadScenario(nurtureEndingScenario); if (isLoaded) { // @warn : callback's calling order StoryMode.ScenarioEndEvent.Attach(onNurtureEndingScenarioEnd); } }
public void LeaveStoryMode() { controller.ActivateVertex (normalModeVertex); controller.cameraZoom.SetZoom(normalModeFOV); if (!controller.useKinect) { foreach(InspectionPointController ipc in GameObject.FindObjectsOfType<InspectionPointController>()) ipc.Unhide(); } storyModeIndicator.SetActive (false); storyMode = StoryMode.DISABLED; }
public void EngageStoryMode() { normalModeVertex = controller.activeVertex; normalModeFOV = controller.cameraZoom.GetZoom(); foreach(InspectionPointController ipc in GameObject.FindObjectsOfType<InspectionPointController>()) ipc.Hide(); storyModeIndicator.SetActive (true); storyMode = StoryMode.STOPPED; activeWaypointIndex = -1; EnterNextWaypoint(); }
public void ChangeWaypoint(int _change) { storyMode = StoryMode.PLAYING; activeWaypointIndex+=_change; activeWaypoint = waypoints[activeWaypointIndex]; if (activeWaypoint.cameraAnimation != null && activeWaypoint.cameraAnimation.Count > 0) { nextAnimationKeyframeStart = UpdateAnimation(0,Time.time); cameraController.continuousTarget = true; } else { animationPosition = new Vector3(); animationRotation = Quaternion.identity; cameraController.continuousTarget = false; } if (activeWaypoint.videoContent != Videos.NONE) { controller.inspector.SetVideo (activeWaypoint.videoContent); } else if (activeWaypoint.imageContent != null) { controller.inspector.SetImage(activeWaypoint.imageContent); } if (activeWaypoint.inspectorCaption != "") { controller.inspector.SetCaption (activeWaypoint.inspectorCaption); } if (activeWaypoint.audioContent != null) { StartCoroutine(PlayAudioContent(activeWaypoint.audioContent,activeWaypoint.audioDelay)); } else { controller.audioController.contentAudioSource.Stop (); } if (activeWaypoint.infoHingeAwayOnEnter) { controller.OnInfoHingeAway(); } else if (activeWaypoint.infoHingeOutOnEnter) { controller.OnInfoHingeOut(); } if (activeWaypoint.inspectorHingeAwayOnEnter) { controller.OnInspectorHingeAway(); } else if (activeWaypoint.inspectorHingeOutOnEnter) { controller.OnInspectorHingeOut(); } lastAnimationLoopStart = Time.time; UpdateStoryVertex(); controller.ActivateVertex(storyVertex); }
/// <summary> /// AskQuestionair(): /// Asks the user a series of questions and store each answer into a list. /// /// Arguments: /// -Depending on the mode selected will determine which intructions are required of the user. /// /// Steps: /// -Create List /// -Display Instructions /// -Get user input. /// -Add input into list. /// -Repeat until all required inputs are supplied. /// -Return the List. /// </summary> private List <string> AskQuestionair(StoryMode storyMode) { List <string> temp = new List <string>(); string userAnswer; switch (storyMode) { case StoryMode.General: Console.WriteLine("Please enter a thing (Plural)"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter an adjective"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter a song title"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter a celebrity"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter a feeling"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter a verb"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter a place"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter a food"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter a thing (Plural)"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter a name"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); return(temp); case StoryMode.PG: Console.WriteLine("Please enter a thing (Plural)"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter another thing (Plural)"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter an occupation"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter a body part"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter an adjective"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter another adjective"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter a Company name"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter a verb"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter a place"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter an adjective"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter a place"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); Console.WriteLine("Please enter a verb (Past tense)"); userAnswer = InputValidation.ValidateInput(); temp.Add(userAnswer); return(temp); default: return(temp); } }