public static void Interacted(BasePart part)
 {
     if (OnInteracted != null)
     {
         OnInteracted.Invoke(part);
     }
 }
Exemplo n.º 2
0
 public static void Interacted(GameObject obj)
 {
     if (OnInteracted != null)
     {
         OnInteracted.Invoke(obj);
     }
 }
 /// <summary>
 /// Interact
 /// </summary>
 public void Interact()
 {
     if (onInteracted != null)
     {
         onInteracted.Invoke();
     }
     OnInteracted?.Invoke();
 }
Exemplo n.º 4
0
 public virtual void Interact(PlayerInteraction playerInteraction = null)
 {
     //Debug.Log(itemName + ": print from interactable");
     OnInteracted?.Invoke(this);
     if (storedObject != null && storedObject.TryGetComponent <Lock>(out Lock testLock))
     {
         Debug.Log("Lol");
         testLock.insertedItem = null;
     }
 }
Exemplo n.º 5
0
        public void Interact()
        {
            if (_currentInteractable == null)
            {
                return;
            }

            _currentInteractable.Interact(with: this);
            OnInteracted?.Invoke();
        }
Exemplo n.º 6
0
        public void Interact(OnInteracted onInteracted = null)
        {
            Collider2D    closestInteractee = GetClosestInteractee();
            IInteractible interactible      = closestInteractee?.GetComponent <IInteractible>();

            if (interactible != null)
            {
                onInteracted?.Invoke(interactible.InteractibleType, interactible.Transform);
                interactible.Trigger(INTERACTIBLE_TYPE.USER, transform);
            }
        }
    void SetInteracting(GameObject _object)
    {
        if (prompting && prompting.gameObject == _object)
        {
            return;
        }
        Debug.Log($"Player interacting {_object.name}");

        var next = _object.GetComponent <Interactable>();

        OnInteracted?.Invoke(next);
        prompting = next;
    }
Exemplo n.º 8
0
    public void Interact(GameObject agent)
    {
        if (active)
        {
            animator.SetTrigger("interactActive");
            active = false;
            animator.SetBool("active", false);
            if (OnInteracted != null)
            {
                OnInteracted.Invoke();
            }

            GetComponent <Collider>().enabled = false;   // DW: this is a note from David about not allowing interaction once something doesn't need it anymore, implemented here as a hack

            GetComponent <AudioSource>().pitch = Random.Range(.8f, 1.2f);
            GetComponent <AudioSource>().Play();     // DW
        }
        else
        {
            animator.SetTrigger("interactInactive");
        }
    }
Exemplo n.º 9
0
 public void Interact(GameObject subject, ActionType action, Data data = null)
 {
     OnInteracted?.Invoke(subject, action, data);
 }