Exemplo n.º 1
0
    public void AsignPosition()
    {
        if (allyMove != null)
        {
            foreach (var hand in hands)
            {
                if (SteamVR_Input.GetStateDown("Shoot", hand.handType))
                {
                    HandSelector hs = hand.GetComponentInChildren <HandSelector>();
                    if (hs != null)
                    {
                        Ray        ray = new Ray(hs.transform.position, hs.transform.forward);
                        RaycastHit hit;
                        if (Physics.Raycast(ray, out hit, 50f))
                        {
                            Debug.Log(hit.transform.gameObject);
                            allyMove.SetPoint(hit.point);
                        }

                        allyMove = null;
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
 public override void OnSelected(Hand hand)
 {
     isBuilding       = true;
     objInstance      = Instantiate(objectToPlace);
     buildingCollider = objInstance.GetComponentInChildren <Collider>();
     handSelector     = hand.GetComponentInChildren <HandSelector>();
     selectedHand     = hand;
 }
Exemplo n.º 3
0
        private static void FindSelectors()
        {
            HandSelector[] selectors = Object.FindObjectsOfType(typeof(HandSelector)) as HandSelector[];

            if (selectors.Length == 0)
            {
                Debug.LogWarning("Found 0 selectors. Expected 2. Not initializing any.");

                return;
            }

            if (selectors.Length == 1)
            {
                Debug.LogWarning("Found 1 selectors. Expected 2.");

                selectorLeft = selectors[0];

                return;
            }

            if (selectors.Length > 2)
            {
                Debug.LogWarning("Found more than 2 selectors. Expected 2.");
            }

            AvatarComponent avatarComponent0 = selectors[0].transform.GetComponentInParent(typeof(AvatarComponent)) as AvatarComponent;

            AvatarComponent avatarComponent1 = selectors[1].transform.GetComponentInParent(typeof(AvatarComponent)) as AvatarComponent;

            if (avatarComponent0.thisEntityType != Entity_Type.users_Lhand && avatarComponent1.thisEntityType != Entity_Type.users_Lhand)
            {
                Debug.LogWarning("Left hand not found.");

                return;
            }

            if (avatarComponent0.thisEntityType != Entity_Type.users_Rhand && avatarComponent1.thisEntityType != Entity_Type.users_Rhand)
            {
                Debug.LogWarning("Right hand not found.");

                return;
            }

            if (avatarComponent0.thisEntityType == Entity_Type.users_Rhand)
            {
                selectorLeft = selectors[1];

                selectorRight = selectors[0];

                return;
            }

            selectorLeft = selectors[0];

            selectorRight = selectors[1];
        }
Exemplo n.º 4
0
 public HandCompare(HandSelector handSelector)
 {
     this.handSelector = handSelector;
 }