Esempio n. 1
0
    // needs refactorization
    void Update()
    {
        if (Input.GetButtonDown("Give") || _interactionTriggered)
        {
            _interactionTriggered = false;

            // try {
            if (_customAccept.ContainsKey(_controller.GetActiveRequirement()))
            {
                CustomAccept c = _customAccept[_controller.GetActiveRequirement()];
                TheTalkable.SetDialogueIndex(c.DialogueIndex);
                _controller.RegisterAsGiven(_controller.GetActiveRequirement());
                TheTalkable.IsForcedToTalk = true;
                c.enabled = false;
                c.Activate();
                return;
            }
            // } catch {}

            if (_canTake && !TheTalkable.IsTalking() &&
                false == TryToTakeRequirement(_controller.GetActiveRequirement()))
            {
                Dialogue[] customRejection    = null;
                bool       hasCustomRejection = false;

                try {
                    customRejection =
                        _customDontNeedThat[_controller.GetActiveRequirement()];
                    hasCustomRejection = true;
                } catch {}

                if (hasCustomRejection)
                {
                    TheTalkable.ForceDialogue(customRejection);
                }
                else
                {
                    TheTalkable.SayIDontWantThat();
                }
            }
        }

        if (false == IsUnblocked &&
            AreRequirementsMet() &&
            TheTalkable.WasDialogueIndexRead(_receibedDialogueIndex))
        {
            Unblock();
        }

        _animator.SetBool("IsWalking", _navMeshAgent.velocity.magnitude > 0.1f);
    }
Esempio n. 2
0
 public void Register(CustomAccept c)
 {
     _customAccept[c.Item] = c;
 }