public void Update() { if (story.canContinue)//text is being drawn { elapsedTime += Time.deltaTime; if (inSpeedyMode || elapsedTime >= lastPrint + timeBetweenPrints) { AudioManager.instance.playTextingSound(AudioManager.instance.textReceivedSound, .3f); lastPrint = elapsedTime; timeBetweenPrints = (Random.Range(0.5f, 1.0f) / Services.GameController.textingSpeed) * SettingsMenu.instance.textSpeed; //Debug.Log("timeBetweenPrints is " + timeBetweenPrints); string text = GetNextContent();//more text is happening //Debug.Log("just read this text: "+text); float myPauseTag = 0; //Elizabeth: this is where I'm trying out evaluating the pause tags //take current tags List <string> pauseTags = story.currentTags; foreach (string tag in story.currentTags) { if (tag.Contains(":")) { //tags are initially in string format, so set them as floats float temp = float.Parse(tag.Split(':')[1]); if (temp > myPauseTag) { myPauseTag = temp; //Debug.Log("Has a tag of "+myPauseTag); } } if (tag.Contains("noyujin")) { RemoveDatesByTag("Yujin"); } if (tag.Contains("yesyujin")) { RemoveTagsFromUsedDates("Yujin"); } if (tag.Contains("IXyes")) { RemoveDatesByTag("IXno"); RemoveTagsFromUsedDates("IXyes"); } if (tag.Contains("IXno")) { RemoveDatesByTag("IXyes"); RemoveTagsFromUsedDates("IXno"); } } if (!inSpeedyMode) { myPauseTag = timeBetweenPrints;// * mySpeedPreference; } else { timeBetweenPrints = 0f; } if (myPauseTag > 0) { currentDotState = dotState.showing; } latestText = text; //set current conversant currentConversant = story.variablesState["conversant_name"] as string; foreach (string tag in story.currentTags) { if (tag.Contains("triggerdate")) { Services.DisplayManager.WriteDate(currentConversant); currentDotState = dotState.off; } } isRosaSpeaking = (int)story.variablesState["is_rosa"] == 1 || justDidAChoice; if (isRosaSpeaking) { AudioManager.instance.playTextingSound(AudioManager.instance.textSentSound, .7f); } else { Services.CharacterManager.characters[currentConversant].textPreview.text = latestText; AudioManager.instance.playTextingSound(AudioManager.instance.textReceivedSound, .3f); } bool check = (int)story.variablesState["conversation_happening"] == 1; //if the current state of conversationHappening is false, but the game was just running if (check == false && conversationHappening == true) { Debug.Log("AAAAH " + text); conversationHappening = false; Services.GameController.lockScreen.OnLockScreenLock(); Services.DisplayManager.WriteText(text, currentConversant, isRosaSpeaking); currentDotState = dotState.off; justDidAChoice = false; SaveSystem.SaveGame(); /*if(isRosaSpeaking == false){ * SimulateNextText(); * }*/ return; } if (check == true && conversationHappening == false) { conversationHappening = true; } Services.DisplayManager.WriteText(text, currentConversant, isRosaSpeaking); madeChoices = false; justDidAChoice = false; } } else //choices!! { if (currentDotState == dotState.showing || currentDotState == dotState.holding) { currentDotState = dotState.shrinking; } if (!madeChoices) { for (int i = 0; i < 3; i++) { if (i < story.currentChoices.Count) { if (story.currentChoices[i].text == "@") { Services.DisplayManager.choices[i].text = ""; break; } else { Services.DisplayManager.choices[i].text = "- " + story.currentChoices[i].text; } } else { Services.DisplayManager.choices[i].text = ""; } } madeChoices = true; } else { } } switch (currentDotState) { case dotState.showing: if (!dotsShowingAlready) { showTimer += Time.deltaTime; if (showTimer >= .75f) { //Debug.Log("Dots are showing"); Services.CharacterManager.characters[currentConversant].textingInProgressIcon.SetActive(true); GrowDots(); dotsShowingAlready = true; showTimer = 0; } } break; case dotState.holding: dotsShowingAlready = false; //Debug.Log("Dots are holding"); break; case dotState.shrinking: if (!dotsShrinkingAlready) { //Debug.Log("Dots are shrinking"); ShrinkDots(); dotsShrinkingAlready = true; } break; case dotState.off: //Debug.Log("Dots are off"); dotsShrinkingAlready = false; Services.CharacterManager.characters[currentConversant].textingInProgressIcon.SetActive(false); break; } if (Input.GetKeyDown(KeyCode.N)) { if (!inSpeedyMode) { inSpeedyMode = true; } else { inSpeedyMode = false; } /* * var myCurrentPath = story.state.currentPathString; * int tries = 0; * * bool shouldContinue = !story.state.currentPathString.Contains(".") || story.state.currentPathString.Split('.')[1] != "debug_fast_forward"; * while(shouldContinue) * { * tries++; * if (tries >= 100) * { * Debug.Log("never found debug_fast_word, probably don't have one in this knot"); * break; * } * if (story.canContinue) * { * story.ContinueMaximally(); * story.ChooseChoiceIndex(0); * } * //Debug.Log(story.state.currentPathString); * shouldContinue = !story.state.currentPathString.Contains(".") || story.state.currentPathString.Split('.')[1] != "debug_fast_forward"; ||} || */ } }
public void ShrinkDots() { Services.CharacterManager.characters[currentConversant].textingInProgressIcon.transform.SetAsLastSibling(); Services.CharacterManager.characters[currentConversant].textingInProgressIcon.transform.DOScale(new Vector3(.1f, .1f, .1f), .35f) .OnComplete(() => currentDotState = dotState.off); }
public void SimulateNextText() { if (story.canContinue == false) { return; } string text = GetNextContent();//more text is happening //Debug.Log("just read this text: "+text); float myPauseTag = 0; //Elizabeth: this is where I'm trying out evaluating the pause tags //take current tags List <string> pauseTags = story.currentTags; foreach (string tag in story.currentTags) { if (tag.Contains("noyujin")) { RemoveDatesByTag("Yujin"); } if (tag.Contains("yesyujin")) { RemoveTagsFromUsedDates("Yujin"); } if (tag.Contains("IXyes")) { RemoveDatesByTag("IXno"); RemoveTagsFromUsedDates("IXyes"); } if (tag.Contains("IXno")) { RemoveDatesByTag("IXyes"); RemoveTagsFromUsedDates("IXno"); } } latestText = text; //set current conversant currentConversant = story.variablesState["conversant_name"] as string; foreach (string tag in story.currentTags) { if (tag.Contains("triggerdate")) { Services.DisplayManager.WriteDate(currentConversant); currentDotState = dotState.off; } } isRosaSpeaking = false; //(int)story.variablesState["is_rosa"] == 1 || justDidAChoice; if (isRosaSpeaking) { AudioManager.instance.playTextingSound(AudioManager.instance.textSentSound, .7f); } else { Services.CharacterManager.characters[currentConversant].textPreview.text = latestText; AudioManager.instance.playTextingSound(AudioManager.instance.textReceivedSound, .3f); } bool check = (int)story.variablesState["conversation_happening"] == 1; //if the current state of conversationHappening is false, but the game was just running Services.DisplayManager.WriteText(text, currentConversant, isRosaSpeaking); }
public void GrowDots() { Services.CharacterManager.characters[currentConversant].textingInProgressIcon.transform.SetAsLastSibling(); Services.CharacterManager.characters[currentConversant].textingInProgressIcon.transform.DOScale(new Vector3(1.155703f, 1.155703f, 10.40116f), .35f) .OnComplete(() => currentDotState = dotState.holding); }