コード例 #1
0
 private void GetInteractInput()
 {
     if (Input.GetAxisRaw("Fire1") > 0)
     {
         OnInteractEvent?.Invoke();
     }
 }
コード例 #2
0
        public void Interact(Entity interactor = null)
        {
            //  Invoke an interact event
            InteractableEvent e = new InteractableEvent {
                entity = interactor, interactable = this, transform = this.transform
            };

            OnInteractEvent?.Invoke(this, e);
            if (e.cancel == true)
            {
                return;
            }                               //  return if the event has been cancelled by any subscriber
        }
コード例 #3
0
 /// OnInteract 델리게이트 초기화용
 void Awake()
 {
     OnInteract += new OnInteractEvent(
         (GameObject door) =>
     {
         if (!_isOpen)
         {
             Open(door);
         }
         else
         {
             Close(door);
         }
     });
 }
コード例 #4
0
    // Every interaction within the button collider
    public virtual void OnInteract(object from, bool activating)
    {
        if (!waitForInactive)
        {
            if (CanActivate())
            {
                if (activating)
                {
                    OnActivate(from);
                }
                else if (!highlighted)
                {
                    OnHighlight(from);
                }
            }

            else if (CanDeactivate())
            {
                if (activating)
                {
                    OnDeactivate(from);
                }
                else if (!highlighted)
                {
                    OnHighlight(from);
                }
            }
        }

        if (waitForInactive && !activating)
        {
            waitForInactive = false;
        }

        OnInteractEvent?.Invoke(this, from, activating);
    }
コード例 #5
0
 public void OnInteract()
 {
     OnInteractEvent?.Invoke();
 }
コード例 #6
0
 public void Interactinput()
 {
     OnInteractEvent?.Invoke();
 }