コード例 #1
0
ファイル: BoardController.cs プロジェクト: ATVLx/SnowHorse
    private void JumpControls()
    {
#if UNITY_XBOXONE
        if (XboxOneInput.GetKeyDown(XboxOneKeyCode.Gamepad1ButtonA) || Input.GetKeyDown(KeyCode.Space))
        {
            if (isGrounded == true)
            {
                _rigid.AddForce(Vector3.up * jumpHeight);

                //Debug.Log("Jump");
            }
        }
#endif

#if UNITY_STANDALONE
        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (isGrounded == true)
            {
                _rigid.AddForce(Vector3.up * jumpHeight);

                //Debug.Log("Jump");
            }
        }
#endif
    }
コード例 #2
0
    public static bool GetKeyUp(string aKey, bool aForce = false)
    {
        if (!(aForce || GameConstants.KB_CONTROL))
        {
            return(false);
        }

        if (keyMap [aKey] == null)
        {
            return(false);
        }
        return(XboxOneInput.GetKeyUp((XboxOneKeyCode)keyMap[aKey]));
    }
コード例 #3
0
    void StopVibration()
    {
#if UNITY_XBOXONE && !UNITY_EDITOR
        GamepadPlugin.SetGamepadVibration(XboxOneInput.GetControllerId(0), 0f, 0f, 0, 0);
#endif

#if UNITY_PS4 && !UNITY_EDITOR
        int val = 0;
        if (int.TryParse(LoginHandler.instance.UserID, out val))
        {
            PS4Input.PadSetVibration(val, 0, 0);
        }
#endif
    }
コード例 #4
0
    void DoVibration()
    {
#if UNITY_XBOXONE && !UNITY_EDITOR
        GamepadPlugin.SetGamepadVibration(XboxOneInput.GetControllerId(0), .5f, .5f, 0, 0);
#endif

#if UNITY_PS4 && !UNITY_EDITOR
        int val = 0;
        if (int.TryParse(LoginHandler.instance.UserID, out val))
        {
            PS4Input.PadSetVibration(val, (int)Mathf.Clamp(127 * scale, 0, 255), (int)Mathf.Clamp(127 * scale, 0, 255));
        }
#endif
    }
コード例 #5
0
        public XboxOneInputDevice(uint joystickId)
            : base("Xbox One Controller")
        {
            JoystickId = joystickId;
            SortOrder  = (int)joystickId;
            Meta       = "Xbox One Device #" + joystickId;

            DeviceClass = InputDeviceClass.Controller;
            DeviceStyle = InputDeviceStyle.XboxOne;

            CacheAnalogAxisNames();

#if UNITY_XBOXONE
            ControllerId = XboxOneInput.GetControllerId(joystickId);
#endif

            AddControl(InputControlType.LeftStickLeft, "Left Stick Left", LowerDeadZone, UpperDeadZone);
            AddControl(InputControlType.LeftStickRight, "Left Stick Right", LowerDeadZone, UpperDeadZone);
            AddControl(InputControlType.LeftStickUp, "Left Stick Up", LowerDeadZone, UpperDeadZone);
            AddControl(InputControlType.LeftStickDown, "Left Stick Down", LowerDeadZone, UpperDeadZone);

            AddControl(InputControlType.RightStickLeft, "Right Stick Left", LowerDeadZone, UpperDeadZone);
            AddControl(InputControlType.RightStickRight, "Right Stick Right", LowerDeadZone, UpperDeadZone);
            AddControl(InputControlType.RightStickUp, "Right Stick Up", LowerDeadZone, UpperDeadZone);
            AddControl(InputControlType.RightStickDown, "Right Stick Down", LowerDeadZone, UpperDeadZone);

            AddControl(InputControlType.LeftTrigger, "Left Trigger", LowerDeadZone, UpperDeadZone);
            AddControl(InputControlType.RightTrigger, "Right Trigger", LowerDeadZone, UpperDeadZone);

            AddControl(InputControlType.DPadUp, "DPad Up", LowerDeadZone, UpperDeadZone);
            AddControl(InputControlType.DPadDown, "DPad Down", LowerDeadZone, UpperDeadZone);
            AddControl(InputControlType.DPadLeft, "DPad Left", LowerDeadZone, UpperDeadZone);
            AddControl(InputControlType.DPadRight, "DPad Right", LowerDeadZone, UpperDeadZone);

            AddControl(InputControlType.Action1, "A");
            AddControl(InputControlType.Action2, "B");
            AddControl(InputControlType.Action3, "X");
            AddControl(InputControlType.Action4, "Y");

            AddControl(InputControlType.LeftBumper, "Left Bumper");
            AddControl(InputControlType.RightBumper, "Right Bumper");

            AddControl(InputControlType.LeftStickButton, "Left Stick Button");
            AddControl(InputControlType.RightStickButton, "Right Stick Button");

            AddControl(InputControlType.View, "View");
            AddControl(InputControlType.Menu, "Menu");
        }
コード例 #6
0
    void OnPreRender()
    {
        if (shakeTime > 0)
        {
            shook            = true;
            originalPosition = T.position;

            Vector3 newPosition = originalPosition;
            newPosition.x += xAdjustment * scale;
            newPosition.y += yAdjustment * scale;
            T.position     = newPosition;
        }
        else
        {
#if UNITY_XBOXONE && !UNITY_EDITOR
            GamepadPlugin.SetGamepadVibration(XboxOneInput.GetControllerId(0), 0, 0, 0, 0);
#endif
        }
    }
コード例 #7
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.M))
        {
            if (m_AudioSource.volume > 0)
            {
                m_AudioSource.volume = 0.0f;
            }
            else
            {
                m_AudioSource.volume = 1.0f;
            }
        }

        if (m_AudioSource.isPlaying == false)
        {
            m_AudioSource.PlayOneShot(m_SongList[currentPlayingTrack]);
            currentPlayingTrack++;
            Debug.Log("Changing song");
        }

#if UNITY_STANDALONE
        //standalone music changing goes here
#endif

#if UNITY_XBOXONE
        if (XboxOneInput.GetKeyDown(XboxOneKeyCode.Gamepad1ButtonDPadRight))
        {
            if (currentPlayingTrack != m_SongList.Length)
            {
                m_AudioSource.PlayOneShot(m_SongList[currentPlayingTrack]);
            }
        }
        else if (XboxOneInput.GetKeyDown(XboxOneKeyCode.Gamepad1ButtonDPadLeft))
        {
            if (currentPlayingTrack != 0)
            {
                m_AudioSource.PlayOneShot(m_SongList[currentPlayingTrack - 1]);
            }
        }
#endif
    }
コード例 #8
0
ファイル: BoardController.cs プロジェクト: ATVLx/SnowHorse
    private void trickControls()
    {
#if UNITY_XBOXONE
        if (XboxOneInput.GetKeyDown(XboxOneKeyCode.Gamepad1ButtonB) || Input.GetKeyDown(KeyCode.L))
        {
            baseTrickRight();
        }
        else if (XboxOneInput.GetKeyDown(XboxOneKeyCode.Gamepad1ButtonX) || Input.GetKeyDown(KeyCode.J))
        {
            baseTrickLeft();
        }
        else if (XboxOneInput.GetKeyDown(XboxOneKeyCode.Gamepad1ButtonY) || Input.GetKeyDown(KeyCode.I))
        {
            baseTrickUp();
        }
        else if (XboxOneInput.GetKeyDown(XboxOneKeyCode.Gamepad1ButtonA) || Input.GetKeyDown(KeyCode.K))
        {
            baseTrickDown();
        }
#endif

#if UNITY_STANDALONE
        if (Input.GetKeyDown(KeyCode.L))
        {
            baseTrickRight();
        }
        else if (Input.GetKeyDown(KeyCode.J))
        {
            baseTrickLeft();
        }
        else if (Input.GetKeyDown(KeyCode.I))
        {
            baseTrickUp();
        }
        else if (Input.GetKeyDown(KeyCode.K))
        {
            baseTrickDown();
        }
#endif
    }
コード例 #9
0
ファイル: PauseController.cs プロジェクト: ATVLx/SnowHorse
	// Update is called once per frame
	void Update () {

#if UNITY_XBOXONE

        if (XboxOneInput.GetKeyDown(XboxOneKeyCode.Gamepad1ButtonMenu))
        {
            pauseGame();
        }

#endif

#if UNITY_STANDALONE

		if (Input.GetKeyDown(KeyCode.Escape))
		{
            pauseGame();
		}

#endif
        
	
	}
コード例 #10
0
        public override void Update(ulong updateTick, float deltaTime)
        {
#if UNITY_XBOXONE
            ControllerId = XboxOneInput.GetControllerId(JoystickId);
            Debug.Log(XboxOneInput + ":" + JoystickId + ":" + ControllerId);
            var lsv = new Vector2(GetAnalogValue(AnalogLeftStickX), -GetAnalogValue(AnalogLeftStickY));
            UpdateLeftStickWithValue(lsv, updateTick, deltaTime);

            var rsv = new Vector2(GetAnalogValue(AnalogRightStickX), -GetAnalogValue(AnalogRightStickY));
            UpdateRightStickWithValue(rsv, updateTick, deltaTime);

            UpdateWithValue(InputControlType.LeftTrigger, GetAnalogValue(AnalogLeftTrigger), updateTick, deltaTime);
            UpdateWithValue(InputControlType.RightTrigger, GetAnalogValue(AnalogRightTrigger), updateTick, deltaTime);

            UpdateWithState(InputControlType.DPadUp, GetButtonState(XboxOneKeyCode.GamepadButtonDPadUp), updateTick, deltaTime);
            UpdateWithState(InputControlType.DPadDown, GetButtonState(XboxOneKeyCode.GamepadButtonDPadDown), updateTick, deltaTime);
            UpdateWithState(InputControlType.DPadLeft, GetButtonState(XboxOneKeyCode.GamepadButtonDPadLeft), updateTick, deltaTime);
            UpdateWithState(InputControlType.DPadRight, GetButtonState(XboxOneKeyCode.GamepadButtonDPadRight), updateTick, deltaTime);

            UpdateWithState(InputControlType.Action1, GetButtonState(XboxOneKeyCode.GamepadButtonA), updateTick, deltaTime);
            UpdateWithState(InputControlType.Action2, GetButtonState(XboxOneKeyCode.GamepadButtonB), updateTick, deltaTime);
            UpdateWithState(InputControlType.Action3, GetButtonState(XboxOneKeyCode.GamepadButtonX), updateTick, deltaTime);
            UpdateWithState(InputControlType.Action4, GetButtonState(XboxOneKeyCode.GamepadButtonY), updateTick, deltaTime);

            UpdateWithState(InputControlType.LeftBumper, GetButtonState(XboxOneKeyCode.GamepadButtonLeftShoulder), updateTick, deltaTime);
            UpdateWithState(InputControlType.RightBumper, GetButtonState(XboxOneKeyCode.GamepadButtonRightShoulder), updateTick, deltaTime);

            UpdateWithState(InputControlType.LeftStickButton, GetButtonState(XboxOneKeyCode.GamepadButtonLeftThumbstick), updateTick, deltaTime);
            UpdateWithState(InputControlType.RightStickButton, GetButtonState(XboxOneKeyCode.GamepadButtonRightThumbstick), updateTick, deltaTime);

            UpdateWithState(InputControlType.View, GetButtonState(XboxOneKeyCode.GamepadButtonView), updateTick, deltaTime);
            UpdateWithState(InputControlType.Menu, GetButtonState(XboxOneKeyCode.GamepadButtonMenu), updateTick, deltaTime);

            Commit(updateTick, deltaTime);
#endif
        }
コード例 #11
0
 public uint XboxOneInput_GetJoystickId(ulong xboxControllerId)
 {
     return(XboxOneInput.GetJoystickId(xboxControllerId));
 }
コード例 #12
0
 public string XboxOneInput_GetControllerType(ulong xboxControllerId)
 {
     return(XboxOneInput.GetControllerType(xboxControllerId));
 }
コード例 #13
0
 public bool XboxOneInput_IsGamepadActive(uint unityJoystickId)
 {
     return(XboxOneInput.IsGamepadActive(unityJoystickId));
 }
コード例 #14
0
 public ulong XboxOneInput_GetControllerId(uint unityJoystickId)
 {
     return(XboxOneInput.GetControllerId(unityJoystickId));
 }
コード例 #15
0
 public int XboxOneInput_GetUserIdForGamepad(uint id)
 {
     return(XboxOneInput.GetUserIdForGamepad(id));
 }
コード例 #16
0
 bool GetButtonState(XboxOneKeyCode keyCode)
 {
     return(XboxOneInput.GetKey(GetButtonKeyCode(keyCode)));
 }
コード例 #17
0
ファイル: XboneKinect.cs プロジェクト: pdlla/perfectwomangame
 public void DeferSystemGestures(float aTime)
 {
     XboxOneInput.DeferSystemGestures(aTime);
 }