CustomDialogueSystemTrigger
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class CustomDialogueSystemTrigger : DialogueSystemTrigger
{
public override void TryStart(Transform actor, Transform interactor)
{
Vector3 vectorToNPC = transform.position - interactor.position;
float angleToNPC = Vector3.Angle(interactor.forward, vectorToNPC);
if (angleToNPC <= 30f) // Is player facing within 30 degrees of the NPC?
{
base.TryStart(actor, interactor);
}
}
}