/// <summary>
 /// Check if the this detector is touched by a specific finger.
 /// </summary>
 /// <param name="finger"></param>
 /// <returns></returns>
 public bool TouchedBy(SenseGloveCs.Finger finger)
 {
     if (finger != SenseGloveCs.Finger.All)
     {
         return(this.finger[(int)finger] > 0);
     }
     else
     {
         for (int i = 0; i < this.finger.Length; i++)
         {
             if (!(this.finger[i] > 0))
             {
                 return(false);
             }
         }
         return(true);
     }
 }
    /// <summary> Send an impact vibration to this script's connected glove, based on a speed in m/s.  </summary>
    /// <param name="impactVelocity"></param>
    public void SendImpactFeedback(float impactVelocity)
    {
        if (handLocation != SG_HandSection.Unknown && impactVelocity >= minImpactSpeed)
        {
            int impactLevel;
            //evaluate the intensity
            if (impactVelocity > maxImpactSpeed || minImpactSpeed >= maxImpactSpeed)
            {
                impactLevel = maxBuzzLevel;
            }
            else
            {
                //map the impact parameters on the speed.
                float mapped = Mathf.Clamp01(SG_Util.Map(impactVelocity, minImpactSpeed, maxImpactSpeed, 0, 1));
                //we're actually start at minBuzzLevel; that's when you can start to feel the Sense Glove vibrations
                impactLevel = (int)(SG_Util.Map(impactProfile.Evaluate(mapped), 0, 1, minBuzzLevel, maxBuzzLevel));
            }
            //actually send the effect
            if (linkedGlove != null)
            {
                if (handLocation == SG_HandSection.Wrist)
                {
                    SenseGloveCs.ThumperEffect effect = impactLevel > 50 ? SenseGloveCs.ThumperEffect.Impact_Thump_100
                        : SenseGloveCs.ThumperEffect.Impact_Thump_30;

                    Debug.Log("Speed: " + impactVelocity + " => " + impactLevel + " => " + effect.ToString());
                    linkedGlove.SendThumperCmd(effect);
                }
                else //finger
                {
                    SenseGloveCs.Finger finger = (SenseGloveCs.Finger)handLocation; //can do this since the finger indices match
                    linkedGlove.SendBuzzCmd(finger, impactLevel, vibrationTime);
                }
                cooldownTimer = 0; //reset cooldown for this finger.
            }
        }
    }