quest machine alert helper added to show alers when receiveing quest from dialogue

This commit is contained in:
2025-05-13 07:55:10 +02:00
parent d67d1054f4
commit 85bc1f5fd0
3 changed files with 599 additions and 781 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,40 @@
using UnityEngine;
using PixelCrushers.QuestMachine;
using Sirenix.OdinInspector;
using UnityEngine.Rendering; // This 'using' directive is fine
// using PixelCrushers.DialogueSystem; // Only if you need Dialogue System specific things here
public class QuestMachineAlertHelper : MonoBehaviour
{
private string m_message ="";
[Button]
public void ShowQuestMachineAlert(string message)
{
m_message = message;
Invoke("ShowAlertInternal", 0.1f); // Delay to ensure the alert UI is ready for display
}
private void ShowAlertInternal()
{
// Access the static property defaultQuestAlertUI from the static QuestMachine class
if (PixelCrushers.QuestMachine.QuestMachine.defaultQuestAlertUI != null)
{
// Call the ShowAlert method on the assigned UI implementation
PixelCrushers.QuestMachine.QuestMachine.defaultQuestAlertUI.ShowAlert(m_message);
Debug.Log($"Quest Machine Alert triggered via helper: {m_message}");
}
else
{
Debug.LogError("QuestMachineAlertHelper: PixelCrushers.QuestMachine.QuestMachine.defaultQuestAlertUI is null. " +
"Ensure you have a 'QuestMachineConfiguration' component in your scene, " +
"and that its 'Default Alert UI' field is assigned to an active GameObject " +
"that has a component implementing IQuestAlertUI (e.g., a StandardUIQuestAlertDisplayer or similar).");
}
}
// Optional: A method that takes no parameters if you want a fixed alert
public void ShowFixedQuestMachineAlert()
{
ShowQuestMachineAlert("Your fixed alert message here!");
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 25ed874c9c0994437beb4203d846dbe3