コード例 #1
0
 void Update()
 {
     // Continually update the UI with the values of the axes.
     LTriggerValueText.text = Gamepad.GetAxis(Xbox360GamepadAxis.LTrigger).ToString("F1");
     RTriggerValueText.text = Gamepad.GetAxis(Xbox360GamepadAxis.RTrigger).ToString("F1");
     LAnalogValueText.text  = "( " + Gamepad.GetAxis(Xbox360GamepadAxis.LAnalogX).ToString("F1") + ", " + Gamepad.GetAxis(Xbox360GamepadAxis.LAnalogY).ToString("F1") + " )";
     RAnalogValueText.text  = "( " + Gamepad.GetAxis(Xbox360GamepadAxis.RAnalogX).ToString("F1") + ", " + Gamepad.GetAxis(Xbox360GamepadAxis.RAnalogY).ToString("F1") + " )";
     DPadValueText.text     = "( " + Gamepad.GetAxis(Xbox360GamepadAxis.DPadX).ToString("F1") + ", " + Gamepad.GetAxis(Xbox360GamepadAxis.DPadY).ToString("F1") + " )";
 }
コード例 #2
0
 void Update()
 {
     if (IsVibratingSlowly)
     {
         Gamepad.SetSlowVibration(Gamepad.GetAxis(Axis));
     }
     if (IsVibratingQuickly)
     {
         Gamepad.SetFastVibration(Gamepad.GetAxis(Axis));
     }
 }
コード例 #3
0
    void Update()
    {
        var fraction  = (Gamepad.GetAxis(Axis) - MinValue) / (MaxValue - MinValue);
        var halfScale = (0.5f * ScaleLength);
        var position  = dial.transform.localPosition;

        position.x = Mathf.Lerp(-halfScale, halfScale, fraction);
        dial.transform.localPosition = position;
    }