Exemplo 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);
    }
Exemplo n.º 2
0
 public bool TryToRepair()
 {
     if (CanRepair())
     {
         _controller.NotifyRepair(this);
         if (false == CantRepair)
         {
             SpawnRepairedItem();
             foreach (Collectable.Tag item in OldItems)
             {
                 _collectionController.RegisterAsGiven(item);
             }
         }
         return(true);
     }
     return(false);
 }