コード例 #1
0
    public float GetSpinSpeed(HandSide hand)
    {
        if (!checkedCylinderRenderer && VRInputBridge.instance.aimScript_ref != null && VRInputBridge.instance.aimScript_ref.gun_script.HasGunComponent(GunAspect.REVOLVER_CYLINDER))
        {
            CylinderVisualComponent cylvis = VRInputBridge.instance.aimScript_ref.gun_script.GetComponent <CylinderVisualComponent>();
            if (cylvis != null)
            {
                if (cylvis.cylinder_assembly.Find("cylinder") != null)
                {
                    cylinderRenderer = cylvis.cylinder_assembly.Find("cylinder").GetComponent <Renderer>();
                }
                else
                {
                    cylinderRenderer = cylvis.cylinder_assembly.GetComponent <Renderer>();
                }
            }
            checkedCylinderRenderer = true;
        }
        if (cylinderRenderer != null)
        {
            switch (hand)
            {
            case HandSide.Right:
                if (cylinderRenderer.bounds.Contains(RHandSphere.transform.position))
                {
                    return(ControllerPose.GetVelocity(SteamVR_Input_Sources.RightHand).y);
                }
                else
                {
                    return(0f);
                }

            case HandSide.Left:
                if (cylinderRenderer.bounds.Contains(LHandSphere.transform.position))
                {
                    return(-ControllerPose.GetVelocity(SteamVR_Input_Sources.LeftHand).y);
                }
                else
                {
                    return(0f);
                }

            default:
                return(ControllerPose.GetVelocity(SteamVR_Input_Sources.RightHand).y);
            }
        }
        else
        {
            return(0f);
        }
    }
コード例 #2
0
 public override void Initialize()
 {
     cvc = gs.GetComponent <CylinderVisualComponent>();
     rcc = gs.GetComponent <RevolverCylinderComponent>();
 }