Beispiel #1
0
        public override IEnumerator InitializeHand(device_type_t deviceType)
        {
            yield return(new WaitForFixedUpdate());

            Hand      targetHand = TargetManager.GetHandController(deviceType);
            Transform target     = targetHand.WristTransform;

            GameObject parent = deviceType == device_type_t.GLOVE_LEFT ? Left.gameObject : Right.gameObject;

            // Initialize visual body
            SphereCollider collider = target.gameObject.AddComponent <SphereCollider>();

            collider.center    = new Vector3(-0.01f, -0.11f, -0.04f);
            collider.radius    = 0.04f;
            collider.isTrigger = true;
            target.gameObject.AddComponent <TriggerBinder>();

            // Initialize the controller
            var hand       = HandFactory.GetHand(parent, HandType.Physics, TargetManager.HandData, this, deviceType);
            var controller = hand as PhysicsHand;

            controller.PhysicsHandSettings   = _physicsHandSettings;
            controller.PhysicsWristSettings  = _physicsWristSettings;
            controller.PhysicsFingerSettings = _physicsFingerSettings;

            controller.Target = targetHand;
            HandControllers.Add(controller);

            controller.Grabber = CreateObjectGrabber(parent, deviceType, target);
        }
Beispiel #2
0
        public void GetHand_GivenAHighCardHand_ReturnsNewHighCardHand()
        {
            List <Card> cards = TestUtil.CreateDefaultHighCardCards();
            Hand        hand  = HandFactory.GetHand(cards);

            Assert.AreEqual(hand.GetHandType(), HandType.HighCard);
        }
Beispiel #3
0
        public void GetHand_GivenAPair_ReturnsNewPairHand()
        {
            List <Card> cards = TestUtil.CreateDefaultPairCards();
            Hand        hand  = HandFactory.GetHand(cards);

            Assert.AreEqual(hand.GetHandType(), HandType.Pair);
        }
Beispiel #4
0
        public void GetHand_GivenAThreeOfAKind_ReturnsNewThreeOfAKindHand()
        {
            List <Card> cards = TestUtil.CreateDefaultThreeOfAKindCards();
            Hand        hand  = HandFactory.GetHand(cards);

            Assert.AreEqual(hand.GetHandType(), HandType.ThreeOfAKind);
        }
Beispiel #5
0
        public void GetHand_GivenAFlush_ReturnsNewFlushHand()
        {
            List <Card> cards = TestUtil.CreateTestFlushCards(Suit.Club, new int[] { 10, 13, 3, 5, 4 });
            Hand        hand  = HandFactory.GetHand(cards);

            Assert.AreEqual(hand.GetHandType(), HandType.Flush);
        }
        /// <summary>
        /// Initialize a hand
        /// </summary>
        /// <param name="deviceType">The devicetype that is dedicated to this hand</param>
        public virtual IEnumerator InitializeHand(device_type_t deviceType)
        {
            GameObject parent = deviceType == device_type_t.GLOVE_LEFT ? RootBoneLeft.gameObject : RootBoneRight.gameObject;
            Hand       hand   = HandFactory.GetHand(parent, HandType.Normal, HandData, this, deviceType);

            _hands.Add(deviceType, hand);
            yield break;
        }
Beispiel #7
0
        /// <summary>
        /// Initialize a hand
        /// </summary>
        /// <param name="deviceType">The devicetype that is dedicated to this hand</param>
        public virtual IEnumerator InitializeHand(device_type_t deviceType)
        {
            GameObject parent = deviceType == device_type_t.GLOVE_LEFT ? Left.gameObject : Right.gameObject;
            Hand       hand   = HandFactory.GetHand(parent, HandType.Normal, HandData, this, deviceType);

            hand.CalibrateKey = _autoAllignHandsKey;
            _hands.Add(deviceType, hand);
            yield break;
        }
Beispiel #8
0
 public Player(string name, List <Card> cards)
 {
     this.Name        = name;
     this.HandOfCards = HandFactory.GetHand(cards);
 }