Ejemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        uiManager_   = UIManager.Instance;
        flagManager_ = FlagManager.Instance;

        // If NPC still has dialogue, show it as interactible.
        UnityAction <FlagManager.EventFlag> checkStillInteractible =
            new UnityAction <FlagManager.EventFlag>((FlagManager.EventFlag flag) =>
        {
            if (currTalkableNPC_ == null)
            {
                return;
            }

            currTalkableNPC_.SetInteractable(currTalkableNPC_.HasAvailableModel());
        });

        flagManager_.AddListener(checkStillInteractible);
        uiManager_.Player = this;

        isWeb = Application.platform != RuntimePlatform.WebGLPlayer;


        dialogueCompletedCb_ = () =>
        {
            state_ = PlayerDialogueState.Inactive;
            return(true);
        };
    }
Ejemplo n.º 2
0
    private void OnTriggerExit(Collider other)
    {
        if (npcLayerMask == (npcLayerMask | (1 << other.gameObject.layer)))
        {
            TalkableNPC npc = other.GetComponent <TalkableNPC>();
            if (npc == null)
            {
                Debug.LogError("Exited trigger of chracter who is not NPC.");
                return;
            }

            if (currTalkableNPC_ != npc)
            {
                Debug.LogWarning("Exiting NPC range of an NPC you weren't in range of.");
                npc.SetInteractable(false);
            }

            currTalkableNPC_.SetInteractable(false);
            currTalkableNPC_ = null;
        }
        else if (teleporterLayerMask == (teleporterLayerMask | (1 << other.gameObject.layer)))
        {
            if (other.GetComponent <TeleportPoint>() == lastTpTarget_)
            {
                lastTpTarget_ = null;
            }
        }
    }
Ejemplo n.º 3
0
    private void OnTriggerEnter(Collider other)
    {
        if (npcLayerMask == (npcLayerMask | (1 << other.gameObject.layer)))
        {
            TalkableNPC npc = other.GetComponent <TalkableNPC>();
            if (npc == null)
            {
                Debug.LogError("Entered trigger of chracter who is not NPC.");
                return;
            }

            if (currTalkableNPC_ != null)
            {
                Debug.LogWarning("Overriding current NPC to talk to.");
                currTalkableNPC_.SetInteractable(false);
            }

            currTalkableNPC_ = npc;
            if (!currTalkableNPC_.HasAvailableModel())
            {
                Debug.LogWarning("This NPC somehow has no avialable dialogue.");
                return;
            }
            currTalkableNPC_.SetInteractable(true);
        }
    }
Ejemplo n.º 4
0
    private void OnTriggerEnter(Collider other)
    {
        if (m_npcLayerMask == (m_npcLayerMask | (1 << other.gameObject.layer)))
        {
            TalkableNPC npc = other.GetComponent <TalkableNPC>();
            if (npc == null)
            {
                Debug.LogError("Entered trigger of chracter who is not NPC.");
                return;
            }

            if (m_currTalkableNPC != null)
            {
                Debug.LogWarning("Overriding current NPC to talk to.");
                m_currTalkableNPC.SetInteractable(false);
            }

            string dialogueNodeName = npc.DialogueNodeName;

            // Check NodeExists
            if (!m_dialogueRunner.NodeExists(dialogueNodeName))
            {
                Debug.LogError(string.Format(
                                   "Dialogue node with name ({0}) does not exist.", dialogueNodeName));
                m_currTalkableNPC = null;
                return;
            }

            m_currTalkableNPC = npc;
            m_currTalkableNPC.SetInteractable(true);
        }
    }
Ejemplo n.º 5
0
    public void OnDialogueCompletion()
    {
        m_playerMovement.SetFrozen(false);
        if (m_currTalkableNPC == null)
        {
            return;
        }
        if (!m_currTalkableNPC.gameObject.activeSelf)
        {
            m_currTalkableNPC = null;
            return;
        }

        m_currTalkableNPC.SetTalkAnim(false);
        m_currTalkableNPC.SetInteractable(true, false);
    }
Ejemplo n.º 6
0
    private void OnTriggerExit(Collider other)
    {
        if (m_npcLayerMask == (m_npcLayerMask | (1 << other.gameObject.layer)))
        {
            TalkableNPC npc = other.GetComponent <TalkableNPC>();
            if (npc == null)
            {
                Debug.LogError("Exited trigger of chracter who is not NPC.");
                return;
            }

            if (m_currTalkableNPC != npc)
            {
                Debug.LogWarning("Exiting NPC range of an NPC you weren't in range of.");
                npc.SetInteractable(false);
            }

            if (m_currTalkableNPC == null)
            {
                return;
            }

            m_currTalkableNPC.SetInteractable(false);
            m_currTalkableNPC = null;
        }
    }