Ejemplo n.º 1
0
    void SteeringControllerAction()
    {
        steeringEnter      = Input.GetKeyDown(KeyCode.Mouse0);
        steeringMouseRight = Input.GetKeyDown(KeyCode.Mouse1);

        steeringTrackUp   = false;
        steeringTrackDown = false;

        if (Input.mouseScrollDelta.y > 0)
        {
            steeringTrackUp = true;
        }
        else if (Input.mouseScrollDelta.y < 0)
        {
            steeringTrackDown = true;
        }


        if (steeringEnter)
        {
            behaviourTool.Engage();
        }
        else if (steeringTrackDown)
        {
            for (int i = 0; i < 10; ++i)
            {
                behaviourTool.ScrollPart(PlacementBehaviour.ToolsetControls.Down);
            }
        }
        else if (steeringTrackUp)
        {
            for (int i = 0; i < 10; ++i)
            {
                behaviourTool.ScrollPart(PlacementBehaviour.ToolsetControls.Up);
            }
        }
        else if (steeringMouseRight)
        {
            behaviourTool.ChangePart(PlacementBehaviour.ToolsetControls.Left);
        }



        if (Input.GetKeyUp(KeyCode.Mouse0))
        {
            behaviourTool.DisEngage();
        }
    }
Ejemplo n.º 2
0
    void SteeringControllerAction()
    {
        steeringTrackPos  = SteamVR_Input.GetVector2(trackPadPos_steering, SteamVR_Input_Sources.Any, true);
        steeringTrackDown = SteamVR_Input.GetStateDown(trackPadClick_steering, SteamVR_Input_Sources.Any, true);
        steeringTrack     = SteamVR_Input.GetState(trackPadClick_steering, SteamVR_Input_Sources.Any, true);

        if (SteamVR_Input.GetStateDown(triggerClick_steering, SteamVR_Input_Sources.Any, true))
        {
            behaviourTool.Engage();
            steeringTriggerDown = true;
        }
        else if (steeringTrackDown && steeringTrackPos.y < 0.5f && steeringTrackPos.y > -0.5f)
        {
            if (steeringTrackPos.x < -0.5f)
            {
                behaviourTool.ChangePart(PlacementBehaviour.ToolsetControls.Left);
            }
            else if (steeringTrackPos.x > 0.5f)
            {
                behaviourTool.ChangePart(PlacementBehaviour.ToolsetControls.Right);
            }
        }
        else if (steeringTrack && steeringTrackPos.x < 0.5f && steeringTrackPos.x > -0.5f)
        {
            if (steeringTrackPos.y < -0.5f)
            {
                behaviourTool.ScrollPart(PlacementBehaviour.ToolsetControls.Down);
            }
            else if (steeringTrackPos.y > 0.5f)
            {
                behaviourTool.ScrollPart(PlacementBehaviour.ToolsetControls.Up);
            }
        }


        if (!SteamVR_Input.GetState(triggerClick_steering, SteamVR_Input_Sources.Any, true) && steeringTriggerDown)
        {
            behaviourTool.DisEngage();
            steeringTriggerDown = false;
        }
    }