Hello, I want if i’ve already talked with a NPC but didn’t takes a quest or Item or else, I want to display out some dialogue.
I implement the interface into the AIConversant.
But my solution not works. I found out that the Condition script never invoke the methode from the interface and I don’t know why?
Here my code:
namespace BS.Dialogue
{
public class AIConversant : MonoBehaviour, IPredicateEvaluator //, IRaycastable
{
[SerializeField] Dialogue theDialogue = null;
[SerializeField] string npcName;
private bool hasTalked = false;
public void HandleDialogue(PlayerController callingController)
{
if (theDialogue == null)
{
return;
}
else
{
callingController.GetComponent<PlayerConversant>().StartDialogue(this, theDialogue);
}
return;
}
public string GetNpcName()
{
return npcName;
}
public void GetDialogue()
{
GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerConversant>().StartDialogue(this, theDialogue);
}
// HasTalked predicate
public bool? Evaluate(string predicate, string[] parameters)
{
switch (predicate)
{
case "HasTalked":
if (GetHasTalked())
{
return HasTalked(parameters[0]);
}
return false;
}
return null;
}
// Is set from the Dialogue Trigger
public void SetHasTalked()
{
hasTalked = true;
}
public bool GetHasTalked()
{
return hasTalked;
}
public bool HasTalked(string dialogueName)
{
return theDialogue.name == dialogueName;
}
}
}
Thanks for every input.