public void DoInteraction() { Direction d = GameObject.Find("Player").GetComponent <PlayerBehavior>().currentDirection; switch (d) { case Direction.Up: facing = Direction.Down; gameObject.GetComponent <Animator>().Play("IdleDown"); break; case Direction.Down: facing = Direction.Up; gameObject.GetComponent <Animator>().Play("IdleUp"); break; case Direction.Right: facing = Direction.Left; gameObject.GetComponent <Animator>().Play("IdleLeft"); break; case Direction.Left: facing = Direction.Right; gameObject.GetComponent <Animator>().Play("IdleRight"); break; default: break; } dc.DisplayDialogue(gameObject); }
void ChangeDialogueOnClick() { if (CurrentSentence == 0) { DialogueControllerRef.OpenDialogue(); } else if (CurrentSentence == DialogueDataRef.Dialogue.Count || (PrintGibberish && CurrentSentence >= 3)) { if (!PrintGibberish) { screenFadeRef.loadNextLevel(); } DialogueControllerRef.CloseDialogue(); CurrentSentence = 0; return; } var characterName = CharacterNamesDataRef.CharacterName[CurrentSentence]; if (CharacterNamesDataRef.CharacterName[CurrentSentence] == "Player_Initial") { characterName = playerName[0] + "..."; } else if (CharacterNamesDataRef.CharacterName[CurrentSentence] == "Player_Name") { characterName = playerName; } var DialogueLine = DialogueDataRef.Dialogue[CurrentSentence]; string replacement; string trueSentence = DialogueDataRef.Dialogue[CurrentSentence]; if (DialogueLine.Contains("Player_Name")) { replacement = DialogueLine.Replace("Player_Name", playerName); trueSentence = replacement; } string sentence = PrintGibberish ? gibberish(trueSentence.Length) : trueSentence; string name = PrintGibberish ? gibberish(characterName.Length) : characterName; DialogueControllerRef.DisplayDialogue(name, sentence); CurrentSentence += 1; }