Untitled
unknown
plain_text
a year ago
2.1 kB
14
Indexable
void JumpToNode(string nodeName)
{
StartCoroutine(JumpToNodeCoroutine(nodeName));
}
IEnumerator JumpToNodeCoroutine(string nodeName)
{
if (dialogueRunner.IsDialogueRunning)
{
dialogueRunner.Stop();
yield return new WaitForSeconds(0.1f);
}
// Start the dialogue from the specified node
Debug.Log("Jumping to node: " + nodeName);
dialogueRunner.StartDialogue(nodeName);
}
public void CoverBlown()
{
//if (!dialogueRunner.IsDialogueRunning) // TODO: fix this
JumpToNode("CoverBlown");
}
[YarnCommand("exitoffice")] // has to be static otherwise doesn't work for some reason
public static void ExitOffice()
{
Debug.Log("ExitOffice in C# called!");
GameManager.Instance.impScript.GoHome();
}
// Method to check the boolean value from Yarn
public void CheckBooleanFromYarn()
{
// Retrieve the bool variable from the YarnProject's VariableStorea
variableStorage.TryGetValue("$YSisLooking", out YSisLooking);
variableStorage.TryGetValue("$YSpatientLeft", out YSpatientLeft);
// Use the boolean value as needed
if (YSisLooking)
{
Debug.Log("is Looking.");
impScript.DisableThinkingAnimation();
if (Input.GetKeyDown(KeyCode.Q))
{
//SetBooleanVariable("$YSseenYouDoStupidShit", true);
CoverBlown();
YSpatientLeft = true;
}
if (!playerScript.sittingInChair && sessionStarted && !YSpatientLeft)
{
Debug.Log("Not sitting in chair.");
SetBooleanVariable("$YSseenYouDoStupidShit", true);
YSpatientLeft = true;
CoverBlown();
}
}
else if (!YSisLooking)
{
impScript.PlayThinkingAnimation();
Debug.Log("is NOT LOOKING.");
}
}
public void SetBooleanVariable(string variableName, bool value)
{
if (dialogueRunner)
{
// Set the variable using the DialogueRunner
variableStorage.SetValue(variableName, value);
}
else
{
Debug.LogError("DialogueRunner is not assigned.");
}
}
Editor is loading...
Leave a Comment