public virtual void CheckInteraction() { if (CurrentInteraction != null && CurrentInteraction != this) { CurrentInteraction.StopInteraction(); } if (Vector3.Distance(transform.position, GetObject.PlayerMonoGameObject.transform.position) <= InteractDistance && DialogHandler.Instance.DialogNodeChain == null) { if (GetObject.PlayerController.InCombat) { Debug.Log("Cannot interact while in combat."); return; } CurrentInteraction = this; GetObject.PlayerController.Interacting = true; var questCondition = CheckForQuestInteraction(); if (questCondition != null) { DialogHandler.Instance.BeginDialog(questCondition); } else { Interaction(); } } }
public virtual void Update() { if (!Initialised) { return; } if (this is InteractableNPC) { var npcInteraction = this as InteractableNPC; if (npcInteraction.NPC.Controller.InCombat || !npcInteraction.NPC.Character.Alive) { if (CurrentInteraction == this) { StopInteraction(); } } } var tooFarAway = !(Vector3.Distance(transform.position, GetObject.PlayerMonoGameObject.transform.position) <= InteractDistance); if (tooFarAway && !GameMaster.CutsceneActive) { if (Interacting) { StopInteraction(); } ShowInteractHint = false; return; } CurrentTarget = this; ShowInteractHint = true; if (Rm_RPGHandler.Instance.DefaultSettings.EnableInteractWithKey && RPG.Input.GetKeyDown(RPG.Input.InteractKey)) { if (CurrentTarget == this) { CheckInteraction(); } } }
public virtual void StopInteraction() { DialogHandler.Instance.EndDialog(); CurrentInteraction = null; GetObject.PlayerController.Interacting = false; }