Skip to content

Commit

Permalink
Add DialogueRunner.SetProject
Browse files Browse the repository at this point in the history
  • Loading branch information
desplesda committed Aug 6, 2024
1 parent 4656e24 commit 6997eba
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Runtime/DialogueRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,27 @@ async YarnTask WaitForOptionsView(AsyncDialogueViewBase? view) {
}
}

/// <summary>
/// Sets the dialogue runner's Yarn Project.
/// </summary>
/// <remarks>
/// If the dialogue runner is currently running (that is, <see
/// cref="IsDialogueRunning"/> is <see langword="true"/>), an <see
/// cref="InvalidOperationException"/> is thrown.
/// </remarks>
/// <param name="project">The new <see cref="YarnProject"/> to be
/// used.</param>
/// <exception cref="InvalidOperationException">Thrown when attempting
/// to set a new project while a dialogue is currently
/// running.</exception>
public void SetProject(YarnProject project) {
if (this.IsDialogueRunning) {
// Can't change project if we're already running.
throw new InvalidOperationException("Can't set project, because dialogue is currently running.");
}
this.yarnProject = project;
}

public void StartDialogue(string nodeName)
{
if (yarnProject == null) {
Expand Down

0 comments on commit 6997eba

Please sign in to comment.