Untitled

mail@pastecode.io avatar
unknown
plain_text
23 days ago
2.1 kB
4
Indexable
Never
  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.");
    }
  }
Leave a Comment