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 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);
        }
    }