public void Handle(SonarrEvent type)
 {
     Program.LogMsg($"Waiting lock for {type.EventType} | {typeof(SonarrEvent)}", Discord.LogSeverity.Info, "OnGrab");
     Lock.WaitOne();
     Program.LogMsg($"Received lock for {type.EventType}", Discord.LogSeverity.Info, "OnGrab");
     try
     {
         if (type is OnTestSonarrEvent t)
         {
             OnTest?.Invoke(this, t);
         }
         else if (type is OnGrabSonarrEvent g)
         {
             Program.LogMsg($"Invoking event for OnGrab", Discord.LogSeverity.Info, "OnGrab");
             Program.LogMsg($"{OnGrab?.GetInvocationList().Length} listeners #4", LogSeverity.Info, "OnGrab");
             OnGrab?.Invoke(this, g);
         }
         else if (type is OnDownloadSonarrEvent d)
         {
             OnDownload?.Invoke(this, d);
         }
     } finally
     {
         Lock.Release();
         Program.LogMsg($"Released lock for {type.EventType}", Discord.LogSeverity.Info, "OnGrab");
     }
 }
Esempio n. 2
0
    /// <summary>
    /// grabbing a object from the linerenderer
    /// </summary>
    /// <param name="focusGo"></param>is the object that is going to be grabbed
    void GrabFromAttachPoint(GameObject focusGo)
    {
        pointer.isgrabbing = true;

        if (focusGo != null && focusGo.GetComponent <Rigidbody>() != null)
        {
            //event
            //if != null
            OnGrab?.Invoke();

            // setting variables
            CurrentGrabbedObject = focusGo;
            Rigidbody grabbedRb = focusGo.GetComponent <Rigidbody>();

            // Configure variables
            if (focusGo.GetComponent <FixedJoint>() == null)
            {
                FixedJoint grabbedJoint = focusGo.AddComponent <FixedJoint>();
                grabbedJoint.connectedBody = dot.GetComponent <Rigidbody>();
            }

            grabbedRb.useGravity  = false;
            grabbedRb.isKinematic = false;
        }
    }
Esempio n. 3
0
        private void ColliderNear(Collider2D collider)
        {
            var grabbable = collider.GetComponentInParent <Grabbable>();

            if (grabbable == null)
            {
                return;
            }
            grabbable.OnGrabberNear(this);
            OnGrab?.Invoke();
        }
    public void Grab(PlayerInput_Interactor grabScript)
    {
        ChangeLayerOfAllColliders(LayerMask.NameToLayer("DontHitPlayer"));
        if (GrabInteractor != null)
        {
            GrabInteractor.ForceDrop();
        }

        GrabInteractor = grabScript;

        OnGrab?.Invoke(this, grabScript);
    }
Esempio n. 5
0
 public IGrabbable Grab(Rigidbody2D player, Vector2 contactPoint)
 {
     if (joint != null)
     {
         joint.anchor          = joint.transform.InverseTransformPoint(contactPoint);
         joint.connectedAnchor = player.transform.InverseTransformPoint(contactPoint);;
         joint.enabled         = true;
         joint.connectedBody   = player;
         OnGrab?.Invoke();
         if (GrabParticle != null)
         {
             ActiveGrab = Instantiate(GrabParticle);
             ActiveGrab.GetComponent <GrabParticle>().myDaddy = transform;
         }
     }
     return(this);
 }
Esempio n. 6
0
 protected virtual void OnGrabProc(System.EventArgs args)
 {
     OnGrab?.Invoke(this, args);
 }