void Awake() { Instance = this; Configurations.GlobalConfiguration = this; CoroutineAccessor = new CoroutineAccessor(); InputManager = new InputManager(); }
internal static ICoroutineAccessor GetMockCoroutineAccessor() { GameObject gameObject = new GameObject(); ICoroutineAccessor coroutineAccessor = gameObject.AddComponent <MockCoroutineAccessor>(); return(coroutineAccessor); }
public DialogueSystem( ITextPresenter textPresenter, ICoroutineAccessor coroutineAccessor, IDialogueSystemElements elements) { this.textPresenter = textPresenter; this.coroutineAccessor = coroutineAccessor; Elements = elements; }
public IEnumerator Say_ShouldWriteAllSpeechTextOnElementSpeechText_WhenPresentingEnds() { // ARRANGE string targetText = "Hello World"; ICoroutineAccessor coroutineAccessor = DialogueTestHelpers.GetMockCoroutineAccessor(); ISpeech mockSpeech = DialogueTestHelpers.GetMockSpeech( targetText, DialogueTestHelpers.GetMockSpeechSettings() ); ITextPresenter mockTextPresenter = new MockTextPresenter(coroutineAccessor); TextMeshProUGUI txtSpeakerName = DialogueTestHelpers.CreateMonoBehaviourObject <TextMeshProUGUI>(); TextMeshProUGUI txtSpeechText = DialogueTestHelpers.CreateMonoBehaviourObject <TextMeshProUGUI>(); GameObject gameObject = new GameObject(); string speakerName = string.Empty; string speechText = string.Empty; IDialogueSystemElements mockDialogueSystemElements = Substitute.For <IDialogueSystemElements>(); mockDialogueSystemElements.DialoguePanel.Returns(gameObject); mockDialogueSystemElements.SpeakerNameDisplay.Returns(txtSpeakerName); mockDialogueSystemElements.SpeakerNameDisplay.Returns(txtSpeakerName); mockDialogueSystemElements.SpeechTextDisplay.Returns(txtSpeechText); mockDialogueSystemElements.SpeakerText.Returns(speakerName); mockDialogueSystemElements.SpeechText.Returns(speechText); IDialogueSystem dialogueSystem = new DialogueSystem( mockTextPresenter, coroutineAccessor, mockDialogueSystemElements ); // ACT dialogueSystem.Say(mockSpeech); while (dialogueSystem.IsSpeaking()) { yield return(new WaitForFixedUpdate()); } // ASSERT Assert.AreEqual(targetText, mockDialogueSystemElements.SpeechText); }
public MockTextPresenter(ICoroutineAccessor coroutineAccessor) { this.coroutineAccessor = coroutineAccessor; }
public DialogueSystem() { textPresenter = new TextPresenter(); coroutineAccessor = Configurations.GlobalConfiguration.CoroutineAccessor; }
public InputManager() { coroutineAccessor = Configurations.GlobalConfiguration.CoroutineAccessor; }
public TextPresenter(ICoroutineAccessor coroutineAccessor, ILineProcessor lineProcessor) { this.coroutineAccessor = coroutineAccessor; this.lineProcessor = lineProcessor; }
public TextPresenter() { coroutineAccessor = Configurations.GlobalConfiguration.CoroutineAccessor; lineProcessor = new LineProcessor <LineSegment>(); }