protected void OnGloveRemoved(SenseGlove_HandModel model)
 {
     if (GloveRemoved != null)
     {
         GloveRemoved(this, new GloveDetectionArgs(model));
     }
 }
 /// <summary> Add a newly detected SenseGlove to the list of detected gloves. </summary>
 /// <param name="model"></param>
 private void AddEntry(SenseGlove_HandModel model)
 {
     this.detectedGloves.Add(model);
     this.detectionTimes.Add(0);
     this.detectedColliders.Add(1); //already add one.
     this.eventFired.Add(false);
 }
    //---------------------------------------------------------------------------------------------------------------------
    // Monobehaviour

    #region Monobehaviour

    // Use this for initialization
    void Start()
    {
        this.senseGlove = this.gameObject.GetComponent <SenseGlove_Object>();
        if (this.senseGlove != null)
        {
            this.senseGlove.CalibrationFinished += SenseGlove_OnCalibrationFinished;
        }
        this.grabScript = this.gameObject.GetComponent <SenseGlove_GrabScript>();
        this.model      = this.senseGlove.GetComponent <SenseGlove_HandModel>();
    }
 /// <summary> Returns the index of the SenseGlove_Handmodel in this detector's detectedGloves. Returns -1 if it is not in the list. </summary>
 /// <param name="grab"></param>
 /// <returns></returns>
 private int HandModelIndex(SenseGlove_HandModel model)
 {
     for (int i = 0; i < this.detectedGloves.Count; i++)
     {
         if (GameObject.ReferenceEquals(model, this.detectedGloves[i]))
         {
             return(i);
         }
     }
     return(-1);
 }
 protected override void FireRemoveEvent(SenseGlove_HandModel model)
 {
     this.SetAudio(false);
     this.SetParticles(false);
     this.SetEffectObject(false);
     if (this.hapticFeedback)
     {
         this.FireHapticFeedback(true);
     }
     this.inUse--;
     base.FireRemoveEvent(model); //do Y, then fire
 }
    //------------------------------------------------------------------------------------------------------
    //   Class Methods

    #region ClassMethods

    protected override void FireDetectEvent(SenseGlove_HandModel model)
    {
        this.SetAudio(true);
        this.SetParticles(true);
        this.SetEffectObject(true);
        if (this.hapticFeedback)
        {
            this.FireHapticFeedback();
        }
        this.inUse++;
        base.FireDetectEvent(model); //do X, then fire
    }
Example #7
0
    //--------------------------------------------------------------------------------------------------------------------------
    // Get / Set attributes for Construction


    /// <summary> Setup the Feedback Collider to use the chosen handmodel as a parent, using its force feedback type. </summary>
    /// <param name="parentModel"></param>
    public void Setup(SenseGlove_HandModel parentModel)
    {
        this.handModel = parentModel;

        Rigidbody RB = this.gameObject.GetComponent <Rigidbody>();

        if (RB == null)
        {
            RB = this.gameObject.AddComponent <Rigidbody>();
        }
        RB.isKinematic = true;
        RB.useGravity  = false;
    }
Example #8
0
    //-----------------------------------------------------------------------------------------------------------------------------------------
    // Monobehaviour

    //Load Resources before Start() function is called
    protected virtual void Awake()
    {
        if (this.senseGlove == null)
        {
            this.senseGlove = this.gameObject.GetComponent <SenseGlove_Object>();
        }
        if (this.handModel == null)
        {
            this.handModel = this.gameObject.GetComponent <SenseGlove_HandModel>();
        }
        if (this.grabReference != null)
        {
            this.lastPosition = grabReference.transform.position;
        }
    }
 /// <summary> Create a new instance of the SenseGlove Detection Arguments </summary>
 /// <param name="grab"></param>
 public GloveDetectionArgs(SenseGlove_HandModel model)
 {
     this.handModel = model;
 }
 /// <summary> A step in between events that can be overridden by sub-classes of the SenseGlove_Detector </summary>
 /// <param name="model"></param>
 protected virtual void FireRemoveEvent(SenseGlove_HandModel model)
 {
     this.OnGloveRemoved(model);
 }