コード例 #1
0
ファイル: Show.cs プロジェクト: RyanChakov/Sbeve
 public void Laser(float cost)
 {
     if (cost <= money.totalmoney)
     {
         money.Buy(cost);
         FC.laser = true;
         LaserHand.SetActive(true);
         HandR.SetActive(false);
         Audio(purchase);
     }
     else
     {
         Audio(notenough);
     }
 }
コード例 #2
0
ファイル: Poser.cs プロジェクト: rakjin/gesticulation
 public void DisconnectFromRigidbody()
 {
     Root.DisconnectFromRigidbody();
     Chest.DisconnectFromRigidbody();
     Head.DisconnectFromRigidbody();
     ThighL.DisconnectFromRigidbody();
     ThighR.DisconnectFromRigidbody();
     ShinL.DisconnectFromRigidbody();
     ShinR.DisconnectFromRigidbody();
     FootL.DisconnectFromRigidbody();
     FootR.DisconnectFromRigidbody();
     ShoulderL.DisconnectFromRigidbody();
     ShoulderR.DisconnectFromRigidbody();
     UpperArmL.DisconnectFromRigidbody();
     UpperArmR.DisconnectFromRigidbody();
     ForearmL.DisconnectFromRigidbody();
     ForearmR.DisconnectFromRigidbody();
     HandL.DisconnectFromRigidbody();
     HandR.DisconnectFromRigidbody();
 }
コード例 #3
0
        /// <summary>
        /// Updates the <see cref="InputState"/> <see cref="State"/>.
        /// Implementation note: The hands may not be initialized/detected yet.
        /// </summary>
        private void UpdateSharedState()
        {
            StatePrev = State;

            HandL.TryGetFeatureValue(CommonUsages.primaryButton, out State.PrimaryBtnL);
            HandL.TryGetFeatureValue(CommonUsages.secondaryButton, out State.SecondaryBtnL);
            HandL.TryGetFeatureValue(CommonUsages.primary2DAxis, out State.PrimaryAxisL);

            HandR.TryGetFeatureValue(CommonUsages.primaryButton, out State.PrimaryBtnR);
            HandR.TryGetFeatureValue(CommonUsages.secondaryButton, out State.SecondaryBtnR);
            HandR.TryGetFeatureValue(CommonUsages.primary2DAxis, out State.PrimaryAxisR);


            // Read values and then convert to world space
            HandL.TryGetFeatureValue(CommonUsages.grip, out State.GripL);
            HandL.TryGetFeatureValue(CommonUsages.trigger, out State.TriggerL);
            HandL.TryGetFeatureValue(CommonUsages.devicePosition, out State.HandPosL);
            HandL.TryGetFeatureValue(CommonUsages.deviceRotation, out State.HandRotL);

            HandR.TryGetFeatureValue(CommonUsages.grip, out State.GripR);
            HandR.TryGetFeatureValue(CommonUsages.trigger, out State.TriggerR);
            HandR.TryGetFeatureValue(CommonUsages.devicePosition, out State.HandPosR);
            HandR.TryGetFeatureValue(CommonUsages.deviceRotation, out State.HandRotR);

            // Convert to world space
            var xrRigRotation = xrRig.rotation;

            State.HandPosL = xrRig.TransformPoint(State.HandPosL);
            State.HandRotL = xrRigRotation * State.HandRotL;
            State.HandPosR = xrRig.TransformPoint(State.HandPosR);
            State.HandRotR = xrRigRotation * State.HandRotR;

            // Update hover targets of rays
            State.IsTeleporting = State.PrimaryAxisL.y > 0.1f; // Threshold should be lower than teleportRayL's
            if (!State.IsTeleporting)
            {
                if (handInteractorL)
                {
                    handInteractorL.GetHoverTargets(_rayHoverTargetsL);
                }
                if (handInteractorR)
                {
                    handInteractorR.GetHoverTargets(_rayHoverTargetsR);
                }
            }

            // Ray Interactor & Teleportation
            UpdateRayInteractors();

            // Input conflict with interactables
            if (handInteractorL)
            {
                State.GripL *= handInteractorL.selectTarget ? 0f : 1f;
            }
            if (handInteractorR)
            {
                State.GripR *= handInteractorR.selectTarget ? 0f : 1f;
            }
            State.TriggerL *= !State.IsTeleporting && _rayHoverTargetsL.Count == 0 ? 1f : 0f;
            State.TriggerR *= !State.IsTeleporting && _rayHoverTargetsR.Count == 0 ? 1f : 0f;

            // Changing Active Tool
            if (State.SecondaryBtnL && !StatePrev.SecondaryBtnL)
            {
                SetActiveTool((ToolType)
                              ((State.ActiveTool.GetHashCode() + 1) % Enum.GetNames(typeof(ToolType)).Length));
            }

            // Brush Resizing
            if (Mathf.Abs(State.PrimaryAxisR.y) > XrBrush.ResizeDeadZone)
            {
                State.BrushRadius = Mathf.Clamp(
                    State.BrushRadius + XrBrush.ResizeSpeed * Time.deltaTime * State.PrimaryAxisR.y,
                    XrBrush.RadiusRange.x, XrBrush.RadiusRange.y);

                if (BrushL)
                {
                    BrushL.SetRadius(State.BrushRadius);
                }
                BrushR.SetRadius(State.BrushRadius);
            }

            // Changing the Active Mesh
            if (State.ActiveTool == ToolType.Transform &&
                State.TriggerR > 0.1f && StatePrev.TriggerR < 0.1f)
            {
                BrushR.SetActiveMesh();
            }
        }
コード例 #4
0
        public void CharacterSetChange(Face face, HandL handL, HandR handR, Helmet helmet, Mask mask, Dress dress, ShoesAll shoes)
        {
            //Debug.Log("옷 갈아입기 실행");
            string faceName = face.ToString();

            for (int i = 0; i < gFace.Length; i++)
            {
                if (faceName == gFace[i].name)
                {
                    gFace[i].SetActive(true);
                }
                else
                {
                    gFace[i].SetActive(false);
                }
            }

            string handLName = handL.ToString();

            for (int i = 0; i < gHandL.Length; i++)
            {
                if (handLName == gHandL[i].name)
                {
                    gHandL[i].SetActive(true);
                }
                else
                {
                    gHandL[i].SetActive(false);
                }
            }

            string handRName = handR.ToString();

            for (int i = 0; i < gHandR.Length; i++)
            {
                if (handRName == gHandR[i].name)
                {
                    gHandR[i].SetActive(true);
                }
                else
                {
                    gHandR[i].SetActive(false);
                }
            }

            string helmetName = helmet.ToString();

            for (int i = 0; i < gHelmet.Length; i++)
            {
                if (helmetName == gHelmet[i].name)
                {
                    gHelmet[i].SetActive(true);
                }
                else
                {
                    gHelmet[i].SetActive(false);
                }
            }

            string maskName = mask.ToString();

            for (int i = 0; i < gMask.Length; i++)
            {
                if (maskName == gMask[i].name)
                {
                    gMask[i].SetActive(true);
                }
                else
                {
                    gMask[i].SetActive(false);
                }
            }

            string dressName = dress.ToString();

            for (int i = 0; i < gDress.Length; i++)
            {
                if (dressName == gDress[i].name)
                {
                    gDress[i].SetActive(true);
                }
                else
                {
                    gDress[i].SetActive(false);
                }
            }

            string shoesName = shoes.ToString();

            for (int i = 0; i < gShoes.Length; i++)
            {
                if (shoesName == gShoes[i].name)
                {
                    gShoes[i].SetActive(true);
                }
                else
                {
                    gShoes[i].SetActive(false);
                }
            }
        }
コード例 #5
0
 public void ChangeCh(Face face, HandL handL, HandR handR, Helmet helmet, Mask mask, Dress dress, ShoesAll shoes)
 {
     CharacterSetChange(face, handL, handR, helmet, mask, dress, shoes);
 }