public void Progress(ConversationObject conversation) { // Reset the conversation if it's different. if (conversation != _targetConversation) { ResetConversation(); } // Start a new conversation. if (_elementIndex == 0) { StartConversation(conversation); conversation.GetElements()[_elementIndex].Display(_conversationContainer); _elementIndex++; } // End the conversation. else if (_elementIndex == conversation.GetElements().Length) { EndConversation(); } // Progress otherwise. else { conversation.GetElements()[_elementIndex].Display(_conversationContainer); _elementIndex++; } }
/// <summary> /// Get Conversation ID /// </summary> private async void GetConversation() { try { //Need headers string accessToken = DataContainer.Token.ToString(); HttpResponseMessage responseMessage = await "https://chronoschat.co/conversations/create".WithHeader("Authorization", "Bearer " + accessToken).PostUrlEncodedAsync(new { recipient_email = DataContainer.Recipient }); string createConversationResponse = await responseMessage.Content.ReadAsStringAsync(); Debug.WriteLine("Json response: " + createConversationResponse); ConversationObject json = JsonConvert.DeserializeObject <ConversationObject>(createConversationResponse); DataContainer.ConversationID = json.id.ToString(); Debug.WriteLine("ConversationID: " + DataContainer.ConversationID); } catch (HttpRequestException hre) { Debug.WriteLine(hre.ToString()); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }
void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.GetComponent <Player>() != null && !active) //&& jumping) { active = true; Player player = other.gameObject.GetComponent <Player>(); player.canMove = false; if (SceneManager.GetActiveScene().buildIndex == 0) { ConversationObject conversationObject = new ConversationObject(); conversationObject.DialogueArray.Add("That was pretty easy, wasn't it?"); conversationObject.Options.Add(new OptionObject { OptionText = "Yes", DialogueId = 0 }); conversationObject.Options.Add(new OptionObject { OptionText = "No", DialogueId = 1 }); StartCoroutine(GameManager.DialogueManager.StartDialogueLoop(conversationObject)); } else { GameManager.StartTransition(); } //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); } }
public IEnumerator StartDialogueLoop(ConversationObject dialogueToDisplay, bool moveAgain = false) { dialogueText.text = ""; dialogueBox.SetActive(true); optionObjs = dialogueToDisplay.Options; optionsCount = optionObjs.Count; dialogueLines = dialogueToDisplay.DialogueArray; yield return(StartCoroutine(StartDisplayDialogue())); if (dialogueToDisplay.Options.Count == 2) { button1.GetComponentInChildren <Text>().text = dialogueToDisplay.Options[0].OptionText; button2.GetComponentInChildren <Text>().text = dialogueToDisplay.Options[1].OptionText; button1.SetActive(true); button2.SetActive(true); Option1Value = dialogueToDisplay.Options[0].DialogueId; Option2Value = dialogueToDisplay.Options[1].DialogueId; } //dialogueBox.SetActive(false); //speakerBox.SetActive(false); if (moveAgain) { Player.canMove = true; } }
public void ButtonSelected(int selected) { int choice = selected == 0 ? Option1Value : Option2Value; button1.gameObject.SetActive(false); button2.gameObject.SetActive(false); switch (choice) { case 0: GameManager.StartTransition(2); break; case 1: GameManager.StartTransition(); break; case 2: //Add a platform GameObject invisibleTile = GameObject.Find("Platform"); invisibleTile.transform.position = new Vector3(27.5f, -1.5f, 0); Player.canMove = true; break; case 3: //Adds a spring GameObject spring = GameObject.Find("Spring"); spring.transform.position = new Vector3(19.5f, .5f, 0); Player.canMove = true; break; case 4: //Adds attack; Player.upgrade = Upgrade.Raygun; ConversationObject conversationObject = new ConversationObject(); //enable meter; conversationObject.DialogueArray.Add("Cool! Try using it with left shift."); StartCoroutine(GameManager.TransitionOut()); Player.canMove = true; StartDialogueLoop(conversationObject); break; case 5: //Adds shadowstep; Player.upgrade = Upgrade.Shadowstep; ConversationObject conversationObject2 = new ConversationObject(); //enable meter; conversationObject2.DialogueArray.Add("Cool! Try using it with left shift."); StartCoroutine(GameManager.TransitionOut()); Player.canMove = true; StartDialogueLoop(conversationObject2); break; } }
// Use this for initialization void Start() { conversation = new ConversationObject("Assets/phrases.txt"); setPhrasesFromLine(1); date = new Dater(); GameObject.Find("Sentence").GetComponent <Text> ().text = ""; }
void OnLevelFinishedLoading(Scene scene, LoadSceneMode mode) { //Player = FindObjectOfType<Player>(); //DialogueManager = FindObjectOfType<DialogueManager>(); ConversationObject conversationObject = new ConversationObject(); Player.canMove = true; switch (SceneManager.GetActiveScene().buildIndex) { case 0: conversationObject.DialogueArray.Add("Ah, hello. You must be the new game tester."); break; case 1: conversationObject.DialogueArray.Add("I couldn't really think of how to make it any easier...so I just removed all the obstacles."); break; case 2: Player.UniqueId = 1; conversationObject.DialogueArray.Add("Okay this one should be a littler harder."); break; case 3: conversationObject.DialogueArray.Add("Keep going!"); break; case 4: conversationObject.DialogueArray.Add("I'm starting to feel confident about this! Nothing can go wrong now!"); Player.UniqueId = 2; break; case 5: conversationObject.DialogueArray.Add("I'll make this one even more difficult."); break; case 6: conversationObject.DialogueArray.Add("You win!"); break; default: break; } if (conversationObject.DialogueArray.Count > 0) { StartCoroutine(DialogueManager.StartDialogueLoop(conversationObject)); } }
public void ResetConversation() { _conversationContainer.gameObject.SetActive(false); _targetConversation = null; _elementIndex = 0; _textToRead = ""; // Delete all container elements. var children = new List <GameObject>(); foreach (Transform child in _conversationContainer) { children.Add(child.gameObject); } children.ForEach(Destroy); }
public override void Interact() { ConversationObject conversationObject = new ConversationObject(); //conversationObject.Speaker = Name; switch (Name) { //case Npc.Priest: // Objective relevantObjective = GameManager.ObjectiveList.Find(x => x.ObjectiveName == Enums.Objective.FindCircle); // int currentLevel = relevantObjective.LevelCurrent; // if(currentLevel == 1) // { // conversationObject.Options.Add(new OptionObject { OptionText = "I'll look for it. (End Conversation)", ActionId = 0, DialogueId = 0 }); // } // else if(currentLevel == 2 || currentLevel == 3) // { // conversationObject.Options.Add(new OptionObject { OptionText = "I have it here.", ActionId = 1, DialogueId = 1 }); // conversationObject.Options.Add(new OptionObject { OptionText = "I'll look for it. (End Conversation)", ActionId = 0, DialogueId = 0 }); // } // switch (currentLevel) // { // case 0: // case 2: // GameManager.CompleteObjective(Enums.Objective.FindCircle); // conversationObject.DialogueArray.Add("Ah, hello. It seems that I've misplaced my lucky circle."); // conversationObject.DialogueArray.Add("Would you be so kind as to retrieve it for me? It's all the way in the next room and that's much too far for me."); // break; // case 1: // case 3: // conversationObject.DialogueArray.Add("Any luck finding my circle?"); // break; // default: // conversationObject.DialogueArray.Add("Thank you for returning that for me."); // break; // } // break; default: break; } StartCoroutine(DialogueManager.StartDialogueLoop(conversationObject)); }
public ConversationObject FetchDialogue(int Id) { ConversationObject conversationObject = new ConversationObject(); switch (Id) { case 0: conversationObject.DialogueArray.Add("That was pretty easy, wasn't it?"); conversationObject.Options.Add(new OptionObject { OptionText = "Yes", DialogueId = 0 }); conversationObject.Options.Add(new OptionObject { OptionText = "No", DialogueId = 1 }); break; } return(conversationObject); }
public IEnumerator ResetScene() { if (canMove) { canMove = false; spriteRenderer.color = new Color(1, 1, 1, 0); rigidBody.velocity = new Vector2(0, 0); yield return(StartCoroutine(GameManager.TransitionIn())); gameObject.transform.position = GameManager.StartingPosition; spriteRenderer.color = new Color(1, 1, 1, 1); yield return(StartCoroutine(GameManager.TransitionOut())); if (UniqueId == 2) { UniqueId = 0; ConversationObject conversationObject = new ConversationObject(); conversationObject.DialogueArray.Add("How would you like to get past the enemy?"); conversationObject.Options.Add(new OptionObject { OptionText = "Attack", DialogueId = 4 }); conversationObject.Options.Add(new OptionObject { OptionText = "Stealth", DialogueId = 5 }); StartCoroutine(GameManager.DialogueManager.StartDialogueLoop(conversationObject)); } else { //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + addToLevel); canMove = true; } //GameManager.StartTransition(0); } // gameObject.transform.position = GameManager.StartingPosition; //Health = MaxHealth; //Healthbar.value = MaxHealth; //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); }
/// <summary> /// Request a conversation with the Bot Service /// </summary> internal IEnumerator StartConversation() { string conversationEndpoint = string.Format("{0}/conversations", botEndpoint); WWWForm webForm = new WWWForm(); using (UnityWebRequest unityWebRequest = UnityWebRequest.Post(conversationEndpoint, webForm)) { unityWebRequest.chunkedTransfer = false; unityWebRequest.SetRequestHeader("Authorization", "Bearer " + botSecret); unityWebRequest.downloadHandler = new DownloadHandlerBuffer(); yield return unityWebRequest.SendWebRequest(); string jsonResponse = unityWebRequest.downloadHandler.text; conversation = new ConversationObject(); conversation = JsonConvert.DeserializeObject<ConversationObject>(jsonResponse); Debug.Log($"Start Conversation - Id: {conversation.ConversationId}"); conversationStarted = true; } // The following call is necessary to create and inject an activity of type //"conversationUpdate" to request a first "introduction" from the Bot Service. StartCoroutine(SendMessageToBot("", botId, botName, "conversationUpdate")); }
//void OnCollisionEnter2D(Collision2D other) //{ // if (other.gameObject.CompareTag("Floor") && (gameObject.transform.position.y - .9f > other.transform.position.y)) //&& jumping) // { // jumping = false; // } //} void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Pit")) { if (UniqueId == 1) { canMove = false; gameObject.transform.position = GameManager.StartingPosition; UniqueId = 0; ConversationObject conversationObject = new ConversationObject(); conversationObject.DialogueArray.Add("Oh, I guess that jump was too far. Sorry. Hmmm, how should I fix this?"); conversationObject.Options.Add(new OptionObject { OptionText = "Add a platform?", DialogueId = 2 }); conversationObject.Options.Add(new OptionObject { OptionText = "Add a spring?", DialogueId = 3 }); StartCoroutine(GameManager.DialogueManager.StartDialogueLoop(conversationObject)); //this.gameObject.SetActive(false); } else { StartCoroutine(ResetScene()); //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } } //else //{ // Interactable changeScene = other.GetComponent<Interactable>(); // if (changeScene != null) // { // insideTrigger = changeScene; // } //} }
public IEnumerator StartCutscene(int id) { switch (id) { case -1: //hide title screen title.text = ""; title.gameObject.SetActive(false); if (GameManager.testing) { Player.canMove = true; } else { yield return(new WaitForSecondsRealtime(1)); bgMusic.Stop(); //cut sound yield return(new WaitForSecondsRealtime(1)); ConversationObject conversationObject1 = new ConversationObject(); conversationObject1.DialogueArray.Add("..."); conversationObject1.Expressions.Add(3); conversationObject1.DialogueArray.Add("Um..."); conversationObject1.Expressions.Add(2); conversationObject1.DialogueArray.Add("Hey there!"); conversationObject1.Expressions.Add(0); conversationObject1.DialogueArray.Add("I’m Devy! I'm the developer for this game. Thank you so much for playing!"); conversationObject1.Expressions.Add(0); conversationObject1.DialogueArray.Add("This is a little embarrassing. When you clicked that button it was supposed to start the game."); conversationObject1.Expressions.Add(2); conversationObject1.DialogueArray.Add("But, um, it looks like it's not working like it's supposed to."); conversationObject1.Expressions.Add(2); conversationObject1.DialogueArray.Add("To be perfectly honest this is actually the first time I've ever made a game. I made it for Wowie jam 3.0."); conversationObject1.Expressions.Add(2); conversationObject1.DialogueArray.Add("I had a lot of fun making it...but I'm still running into some issues."); conversationObject1.Expressions.Add(2); conversationObject1.DialogueArray.Add("Do you think you could help me out by playtesting and telling me what you think?"); conversationObject1.Expressions.Add(3); conversationObject1.DialogueArray.Add("You will? Thanks! My first ever playtester! I’ll def buy you lunch!"); conversationObject1.Expressions.Add(0); conversationObject1.DialogueArray.Add("So the controls are simple. A moves left. D moves right. Use space to jump."); conversationObject1.Expressions.Add(0); conversationObject1.DialogueArray.Add("Oh, right. I forgot the button that starts the game isn't working."); conversationObject1.Expressions.Add(2); conversationObject1.DialogueArray.Add("I'll just go ahead and start it manually. I'll fix the button later."); conversationObject1.Expressions.Add(2); conversationObject1.DialogueArray.Add("Have fun!"); conversationObject1.Expressions.Add(0); yield return(StartCoroutine(GameManager.DialogueManager.StartDialogueLoop(conversationObject1, true))); bgMusic.Play(); } break; case 1: break; case 2: ConversationObject conversationObject = new ConversationObject(); conversationObject.DialogueArray.Add("How would you like to get past the enemy?"); conversationObject.Options.Add(new OptionObject { OptionText = "Attack", DialogueId = 4 }); conversationObject.Options.Add(new OptionObject { OptionText = "Stealth", DialogueId = 5 }); StartCoroutine(GameManager.DialogueManager.StartDialogueLoop(conversationObject)); break; case 3: ConversationObject conversationObjectEnd = new ConversationObject(); conversationObjectEnd.DialogueArray.Add("You actually made it to the end!"); conversationObjectEnd.Expressions.Add(0); conversationObjectEnd.DialogueArray.Add("GASP, games need to have a satisfying ending...!"); conversationObjectEnd.Expressions.Add(3); conversationObjectEnd.DialogueArray.Add("Uh...here!"); conversationObjectEnd.Expressions.Add(2); yield return(StartCoroutine(GameManager.DialogueManager.StartDialogueLoop(conversationObjectEnd))); title.text = "The real treasure is the friends we made along the way!"; title.gameObject.SetActive(true); audioManager.PlaySfx(SoundEffect.Goal); ConversationObject conversationObjectEnd2 = new ConversationObject(); conversationObjectEnd2.DialogueArray.Add("Meh, that’s pretty cliche."); conversationObjectEnd2.Expressions.Add(2); conversationObjectEnd2.DialogueArray.Add("How about..."); conversationObjectEnd2.Expressions.Add(2); yield return(StartCoroutine(GameManager.DialogueManager.StartDialogueLoop(conversationObjectEnd2))); title.text = "The real treasure is the friends we made along the way! And also the treasure!"; GameObject treasure = GameObject.Find("Treasure"); treasure.transform.position = new Vector3(3, .5f, -1); audioManager.PlaySfx(SoundEffect.Goal); yield return(new WaitForSecondsRealtime(2)); ConversationObject conversationObjectEnd3 = new ConversationObject(); conversationObjectEnd3.DialogueArray.Add("Much better!"); conversationObjectEnd3.Expressions.Add(0); yield return(StartCoroutine(GameManager.DialogueManager.StartDialogueLoop(conversationObjectEnd3))); yield return(new WaitForSecondsRealtime(2)); title.text = ""; title.color = Color.white; yield return(StartCoroutine(GameManager.TransitionIn())); title.text = "Thank you for playing!" + Environment.NewLine + Environment.NewLine + "Amanda Swiger (Aswagger) - Producer" + Environment.NewLine + "Emily Woods - Art" + Environment.NewLine + "Giordano Nin - Game Design" + Environment.NewLine + "Jake Gosche (Goatcheese) - Programming" + Environment.NewLine + "Ostrich2401 - Sound Design"; break; case 4: //Adds attack; ConversationObject conversationObject4 = new ConversationObject(); //enable meter; conversationObject4.DialogueArray.Add("Okay, let's add some platforms!"); conversationObject4.Expressions.Add(0); yield return(StartCoroutine(StartDialogueLoop(conversationObject4))); GameManager.StartTransition(); break; case 5: //Adds attack; ConversationObject conversationObject5 = new ConversationObject(); //enable meter; conversationObject5.DialogueArray.Add("Okay, let's add some springs!"); conversationObject5.Expressions.Add(0); yield return(StartCoroutine(StartDialogueLoop(conversationObject5))); GameManager.StartTransition(2); break; } yield return(null); }
public void ButtonSelected(int selected) { audioManager.PlaySfx(SoundEffect.Click); optionsDisplayed = false; dialogueText.text = ""; int choice; if (selected == 0) { choice = Option1Value; } else if (selected == 1) { choice = Option2Value; } else { choice = -1; //button1.gameObject.SetActive(false); playButton.gameObject.SetActive(false); } //if (choice >= 0) //{ button1.gameObject.SetActive(false); button2.gameObject.SetActive(false); //} switch (choice) { case -1: StartCoroutine(StartCutscene(-1)); break; case 0: GameManager.StartTransition(); break; case 1: GameManager.StartTransition(); break; case 2: //Add a platform StartCoroutine(StartCutscene(4)); // GameObject invisibleTile = GameObject.Find("Platform"); //// invisibleTile.transform.position = new Vector3(27.5f, -1.5f, 0); // ConversationObject conversationObject3 = new ConversationObject(); // conversationObject3.DialogueArray.Add("Okay, let's use some platforms!"); // conversationObject3.DialogueArray.Add("I like it. It feels...well, like a game!"); // StartCoroutine(StartDialogueLoop(conversationObject3, true)); //Player.canMove = true; break; case 3: //Adds a spring StartCoroutine(StartCutscene(5)); //ConversationObject conversationObject4 = new ConversationObject(); //conversationObject4.DialogueArray.Add("Spring it is!"); //conversationObject4.DialogueArray.Add("Alright, it took a bit of coding, but you should be able to bounce across now!"); //GameObject spring = GameObject.Find("Spring"); //spring.transform.position = new Vector3(19.5f, .5f, 0); ////Player.canMove = true; //StartCoroutine(StartDialogueLoop(conversationObject4, true)); break; case 4: //Adds attack; Player.upgrade = Upgrade.Shadowstep; ConversationObject conversationObject = new ConversationObject(); //enable meter; conversationObject.DialogueArray.Add("Shadowstep lets you phase past enemies."); conversationObject.Expressions.Add(2); conversationObject.DialogueArray.Add("If you press left shift you'll be able to move through enemies for a couple seconds. Try it out!"); conversationObject.Expressions.Add(0); Player.slider.gameObject.SetActive(true); //StartCoroutine(GameManager.TransitionOut()); //Player.canMove = true; StartCoroutine(StartDialogueLoop(conversationObject, true)); break; case 5: //Adds shadowstep; Player.upgrade = Upgrade.Raygun; ConversationObject conversationObject2 = new ConversationObject(); //enable meter; conversationObject2.DialogueArray.Add("The ray gun lets you fire a projectile at enemies."); conversationObject2.Expressions.Add(2); conversationObject2.DialogueArray.Add("Press left shift to fire your LAZER CANNON!!!"); conversationObject2.Expressions.Add(0); conversationObject2.DialogueArray.Add("Ah--do people still know that joke?"); conversationObject2.Expressions.Add(2); //StartCoroutine(GameManager.TransitionOut()); //Player.canMove = true; StartCoroutine(StartDialogueLoop(conversationObject2, true)); break; } }
public async Task None(IDialogContext context, IAwaitable <IMessageActivity> activity, LuisResult result) { LanguageManager lang = await LanguageManager.GetLanguage(context, activity); string message = ""; string image = ""; if (result.Entities.Any(e => e.Type == "Genexus")) { message = lang.Genexus; } else { ConversationObject convObj = await Watson.Conversation.SendMessage(result.Query); if (convObj != null && convObj.entities.Length > 0) { ConversationEntity convEnt = convObj.entities[0]; WatsonEntityHelper.Entity ent = WatsonEntityHelper.GetEntity(convEnt.entity); Break b; switch (ent) { case WatsonEntityHelper.Entity.Radisson: message = lang.Map; image = ImageHelper.GetLocationImage(); break; case WatsonEntityHelper.Entity.CoatCheck: message = lang.CoatCheck; image = ImageHelper.GetCoatCheck(); break; case WatsonEntityHelper.Entity.FrontDesk: message = lang.FrontDesk; break; case WatsonEntityHelper.Entity.Room: int floor; image = ImageHelper.GetRoomImage(convEnt.value, out floor); message = string.Format(lang.RoomMap, convEnt.value, floor); break; case WatsonEntityHelper.Entity.Break: b = NextBreak.Find(); if (b != null) { message = string.Format(lang.Break, b.Sessionstarttimetext, convEnt.value); } else { message = lang.NoMoreBreaks; } break; case WatsonEntityHelper.Entity.Snack: b = NextBreak.Find(); if (b != null) { message = string.Format(lang.Snack, b.Sessionstarttimetext, convEnt.value); } else { message = lang.NoMoreBreaks; } break; case WatsonEntityHelper.Entity.TimeQ: break; default: break; } } } if (string.IsNullOrEmpty(message) && result.Query.Length > 2) { SearchServiceSoapClient client = new SearchServiceSoapClient(); List <SourceParam> parm = new List <SourceParam>(); parm.Add(new SourceParam() { sourceName = BotConfiguration.GXSEARCH_KEY }); Search2Response response = await client.Search2Async($"{result.Query} webidioid:{lang.SearchCode}", parm.ToArray(), "SearchHighlight", 1, 10); if (response.Body.Search2Result.DocumentsCount > 0) { await SendMessage(context, string.Format(lang.SearchFound, response.Body.Search2Result.DocumentsCount, result.Query), result.Query, NONE); foreach (var doc in response.Body.Search2Result.Documents) { StringBuilder msg = new StringBuilder($"- {doc.Description.Sanitize()}"); foreach (var p in doc.Properties) { if (p.Key == "charlaexp") { msg.Append($" ({p.Value.Sanitize()})"); } } await SendMessage(context, msg.ToString()); } context.Wait(MessageReceived); return; } } if (string.IsNullOrEmpty(message)) { int fails = 1; if (context.UserData.TryGetValue <int>(CONSECUTIVES_FAILS, out fails)) { fails++; if (fails > 6) { message = lang.MyBad6; } else if (fails > 4) { message = lang.MyBad4; } else if (fails > 2) { message = lang.MyBad2; } else { message = lang.MyBad1; } } else { message = lang.MyBad1; } context.UserData.SetValue <int>(CONSECUTIVES_FAILS, fails); } else { OnSuccess(context); } await SendMessage(context, message, image, result.Query, NONE); context.Wait(MessageReceived); }
public async Task Location(IDialogContext context, IAwaitable <IMessageActivity> activity, LuisResult result) { if (IsScoreTooLow(context, result)) { await None(context, activity, result); return; } else { OnSuccess(context); } LanguageManager lang = await LanguageManager.GetLanguage(context, activity); ConversationObject convObj = await Watson.Conversation.SendMessage(result.Query); if (convObj != null && convObj.entities.Length > 0) { ConversationEntity entity = convObj.entities[0]; WatsonEntityHelper.Entity ent = WatsonEntityHelper.GetEntity(entity.entity); string message = ""; // $"{entity.entity}:{entity.value}"; string image = null; Break b; switch (ent) { case WatsonEntityHelper.Entity.CDS: break; case WatsonEntityHelper.Entity.Radisson: message = lang.Map; image = ImageHelper.GetLocationImage(); break; case WatsonEntityHelper.Entity.CoatCheck: message = lang.CoatCheck; image = ImageHelper.GetCoatCheck(); break; case WatsonEntityHelper.Entity.FrontDesk: message = lang.FrontDesk; break; case WatsonEntityHelper.Entity.Room: int floor; image = ImageHelper.GetRoomImage(entity.value, out floor); message = string.Format(lang.RoomMap, entity.value, floor); break; case WatsonEntityHelper.Entity.Break: b = NextBreak.Find(); if (b != null) { message = string.Format(lang.Break, b.Sessionstarttimetext); } else { message = lang.NoMoreBreaks; } break; case WatsonEntityHelper.Entity.Snack: b = NextBreak.Find(); if (b != null) { message = string.Format(lang.Snack, b.Sessionstarttimetext, entity.value); } else { message = lang.NoMoreBreaks; } break; case WatsonEntityHelper.Entity.Restroom: var floors = new[] { 2, 3, 4 }; PromptDialog.Choice(context, RestroomFloorComplete, floors, string.Format(lang.WhatFloor, floors), string.Format(lang.InvalidFloor, floors), 3, PromptStyle.Auto); return; default: break; } await SendMessage(context, message, image, result.Query, LOCATION); } else { await SendMessage(context, lang.NoLocation, result.Query, LOCATION); } context.Wait(MessageReceived); }
public IEnumerator ResetScene(bool startMoving = false) { animator.SetBool("IsMoving", false); animator.SetBool("IsJumping", false); if (canMove) { foreach (Enemy enemy in GameManager.enemies) { enemy.gameObject.SetActive(true); } canMove = false; spriteRenderer.color = new Color(1, 1, 1, 0); rigidBody.velocity = new Vector2(0, 0); yield return(StartCoroutine(GameManager.TransitionIn())); gameObject.transform.position = GameManager.StartingPosition; spriteRenderer.color = new Color(1, 1, 1, 1); yield return(StartCoroutine(GameManager.TransitionOut())); if (UniqueId == 3) { UniqueId = 0; ConversationObject conversationObject = new ConversationObject(); conversationObject.DialogueArray.Add("Wait, wait, wait."); conversationObject.Expressions.Add(2); conversationObject.DialogueArray.Add("Oh, you need some kind of ability to get past that enemy."); conversationObject.Expressions.Add(3); conversationObject.DialogueArray.Add("Sorry, I should’ve thought of that."); conversationObject.Expressions.Add(3); conversationObject.DialogueArray.Add("Let me think. Hm..."); conversationObject.Expressions.Add(2); conversationObject.DialogueArray.Add("So I can give you an attack to use against that enemy. Maybe like a little ray gun."); conversationObject.Expressions.Add(1); conversationObject.DialogueArray.Add("Or if you're the stealthy type, we could try an ability that lets you pass through the enemy unharmed. We'll call that shadowstep."); conversationObject.Expressions.Add(1); conversationObject.DialogueArray.Add("So what'll it be? Ray gun or shadowstep?"); conversationObject.Expressions.Add(0); conversationObject.Options.Add(new OptionObject { OptionText = "Shadowstep", DialogueId = 4 }); conversationObject.Options.Add(new OptionObject { OptionText = "Ray gun", DialogueId = 5 }); StartCoroutine(GameManager.DialogueManager.StartDialogueLoop(conversationObject)); } else if (UniqueId == 1) { UniqueId = 0; ConversationObject conversationObject = new ConversationObject(); conversationObject.DialogueArray.Add("Oh, maybe it's too hard now..."); conversationObject.Expressions.Add(2); conversationObject.DialogueArray.Add("I bet I can add some things to the scene to make it more passable."); conversationObject.Expressions.Add(1); conversationObject.DialogueArray.Add("But I'm just not sure what..."); conversationObject.Expressions.Add(2); conversationObject.Options.Add(new OptionObject { OptionText = "Add platforms?", DialogueId = 2 }); conversationObject.Options.Add(new OptionObject { OptionText = "Add springs?", DialogueId = 3 }); StartCoroutine(GameManager.DialogueManager.StartDialogueLoop(conversationObject)); //StartCoroutine() } else { //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + addToLevel); canMove = true; } //GameManager.StartTransition(0); } // gameObject.transform.position = GameManager.StartingPosition; //Health = MaxHealth; //Healthbar.value = MaxHealth; //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); }
public void StartConversation(ConversationObject conversation) { _targetConversation = conversation; _conversationContainer.gameObject.SetActive(true); }
IEnumerator TalkTo(MovieActionObject m) { ConversationObject c = m.conversation; Human leftHuman = GameController.instance.gameManager.humanManager.FindHumanByName(c.CharacterLeftName); Human rightHuman = GameController.instance.gameManager.humanManager.FindHumanByName(c.CharacterRightName); movieAction = ActionType.Talk; int length = 0; bool left = false; if (leftHuman == human) { left = true; } length += c.Conversation_1_Left.Length; length += c.Conversation_2_Right.Length; int phrase = 0; int sentence = 0; if (left) { CreateSpeechBubble(c.Conversation_1_Left[sentence]); leftHuman._speechDone = false; sentence++; } while (phrase < length) { if ((phrase == 0 || phrase % 2 == 0)) { if (leftHuman._speechDone) { phrase++; if (rightHuman == human && phrase < length) { human._speechDone = false; movieAction = ActionType.WaitForEvent; } } } else if ((phrase % 2 != 0)) { if (rightHuman._speechDone) { phrase++; if (leftHuman == human && phrase < length) { human._speechDone = false; movieAction = ActionType.WaitForEvent; } } } if (movieAction == ActionType.WaitForEvent) { if (left) { CreateSpeechBubble(c.Conversation_1_Left[sentence]); } else { CreateSpeechBubble(c.Conversation_2_Right[sentence]); } movieAction = ActionType.Talk; sentence++; } yield return(new WaitForEndOfFrame()); } //SpeechBubbleCanvas.gameObject.SetActive(false); movieAction = ActionType.idle; human._speechDone = false; yield return(new WaitForEndOfFrame()); }
void OnLevelFinishedLoading(Scene scene, LoadSceneMode mode) { //Player = FindObjectOfType<Player>(); //DialogueManager = FindObjectOfType<DialogueManager>(); ConversationObject conversationObject = new ConversationObject(); Player.gameObject.transform.position = StartingPosition; Player.spriteRenderer.color = new Color(1, 1, 1, 1); Player.canMove = false; bool startMoving = true; enemies.Clear(); foreach (Enemy enemy in FindObjectsOfType <Enemy>()) { enemies.Add(enemy); } switch (SceneManager.GetActiveScene().buildIndex) { case 0: //conversationObject.DialogueArray.Add("Hey there!"); //conversationObject.DialogueArray.Add("I’m Devy! Thanks so much for playing my game!"); //conversationObject.DialogueArray.Add("This is actually the first game I've ever made."); //conversationObject.DialogueArray.Add("I'm having a lot of fun making it...but I'm not too confident yet."); //conversationObject.DialogueArray.Add("Do you think you could help me out?"); //conversationObject.DialogueArray.Add("I made this game for the Wowie jam 3.0."); //conversationObject.DialogueArray.Add("It's a bit rough around the edges, but I think you will enjoy."); //conversationObject.DialogueArray.Add("Can you playtest it and tell me what you think?"); //conversationObject.DialogueArray.Add("You will? Thanks! I’ll def buy you lunch!"); //conversationObject.DialogueArray.Add("Controls are simple. A moves left. D moves right. Use space to jump."); //conversationObject.DialogueArray.Add("Alright, let's do this. Just click the play button!"); //conversationObject.Options.Add(new OptionObject { OptionText = "Play", DialogueId = -1 }); //startMoving = false; //LEVEL 1.0(Game Screens 1 + 2) //conversationObject.DialogueArray.Add("Okay, this is level 1. Pretty neat, right ?"); //conversationObject.DialogueArray.Add("It’s just the beginning, but I feel good about it."); //LEVEL 1.1(Game Screen 3, 4, 5) //conversationObject.DialogueArray.Add("I updated the level and made it harder."); //conversationObject.DialogueArray.Add("Bet you can’t beat it so fast now!"); //LEVEL 2.0 //conversationObject.DialogueArray.Add("Ray Gun lets you fire a projectile at enemies."); //conversationObject.DialogueArray.Add("Press Left Shirt to fire your LAZER CANNON!!!"); //conversationObject.DialogueArray.Add("Ah--do people still know that joke?"); break; //case 1: // conversationObject.DialogueArray.Add("I couldn't really think of how to make it any easier...so I just removed all the obstacles."); // break; case 1: Player.UniqueId = 1; conversationObject.DialogueArray.Add("Wow, you...you did that pretty fast."); conversationObject.Expressions.Add(3); conversationObject.DialogueArray.Add("Maybe that level was too easy."); conversationObject.Expressions.Add(2); conversationObject.DialogueArray.Add("Let’s make it a little more challenging, shall we?"); conversationObject.Expressions.Add(1); conversationObject.DialogueArray.Add("I bet you can’t beat this level so fast!"); conversationObject.Expressions.Add(0); break; case 2: case 3: Player.canMove = true; break; case 4: conversationObject.DialogueArray.Add("I'm starting to feel confident about this! Nothing can go wrong now!"); conversationObject.Expressions.Add(0); Player.UniqueId = 2; break; case 5: conversationObject.DialogueArray.Add("Well, this is it!"); conversationObject.Expressions.Add(3); conversationObject.DialogueArray.Add("This is the last level! It needs to be super hard!"); conversationObject.Expressions.Add(1); conversationObject.DialogueArray.Add("And believe me! It would have been!"); conversationObject.Expressions.Add(1); conversationObject.DialogueArray.Add("If I hadn't run out of time while making the level."); conversationObject.Expressions.Add(0); break; case 6: StartCoroutine(DialogueManager.StartCutscene(3)); //conversationObject.DialogueArray.Add("You actually made it to the end!"); //conversationObject.DialogueArray.Add("GASP, games need to have a satisfying ending...!"); //conversationObject.DialogueArray.Add("Uh...!The real treasure is the friends we made along the way!"); //conversationObject.DialogueArray.Add("Meh, that’s pretty cliche…"); //conversationObject.DialogueArray.Add("OH, AND TREASURE!"); break; default: break; } if (conversationObject.DialogueArray.Count > 0) { StartCoroutine(DialogueManager.StartDialogueLoop(conversationObject, startMoving)); } }