예제 #1
0
        public void NotifyCollisionStay(Collider collider, CollisionZone collisionZone)
        {
            Debug.Log("Collision Stay: " + collider + " from Left? " + collisionZone.isLeft + " Finger:" + collisionZone.finger);

            IDataSender sender;

            if (TryGetSender(collisionZone, out sender))
            {
                DateTime[] timeouts;
                bool[]     stopMessageSent;
                if (collisionZone.isLeft)
                {
                    timeouts        = _timeoutsLeft;
                    stopMessageSent = _sentStopMessageLeft;
                }
                else
                {
                    timeouts        = _timeoutsRight;
                    stopMessageSent = _sentStopMessageRight;
                }

                var finger = (int)collisionZone.finger;
                if (timeouts[finger] <= DateTime.Now || stopMessageSent[finger])
                {
                    sender.SendString(collisionZone.finger, Intensity);
                    timeouts[finger]        = DateTime.Now + _timeoutDelay;
                    stopMessageSent[finger] = false;
                }
            }
        }
예제 #2
0
        private bool TryGetSender(CollisionZone collisionZone, out IDataSender sender)
        {
            if (collisionZone.isLeft)
            {
                sender = _leftHand;
                return(_leftHandInitialized);
            }

            sender = _rightHand;
            return(_rightHandInitialized);
        }
예제 #3
0
 public void NotifyCollisionExit(Collider collider, CollisionZone collisionZone)
 {
 }
예제 #4
0
 public void NotifyCollisionEnter(Collider collider, CollisionZone collisionZone)
 {
 }