Commit 20933192 by Tim Reiter

fixed gamepad input bug.

parent 7d9c2dd3
...@@ -90,7 +90,7 @@ public class Menu : MonoBehaviour ...@@ -90,7 +90,7 @@ public class Menu : MonoBehaviour
} }
} }
if (GamePad.GetButton(GamePad.Button.A, GamePad.Index.One)) if (GamePad.GetButtonDown(GamePad.Button.A, GamePad.Index.One))
{ {
if (GP1Added) if (GP1Added)
{ {
...@@ -110,7 +110,7 @@ public class Menu : MonoBehaviour ...@@ -110,7 +110,7 @@ public class Menu : MonoBehaviour
} }
} }
if (GamePad.GetButton(GamePad.Button.A, GamePad.Index.Two)) if (GamePad.GetButtonDown(GamePad.Button.A, GamePad.Index.Two))
{ {
if (GP2Added) if (GP2Added)
{ {
...@@ -130,7 +130,7 @@ public class Menu : MonoBehaviour ...@@ -130,7 +130,7 @@ public class Menu : MonoBehaviour
} }
} }
if (GamePad.GetButton(GamePad.Button.A, GamePad.Index.Three)) if (GamePad.GetButtonDown(GamePad.Button.A, GamePad.Index.Three))
{ {
if (GP3Added) if (GP3Added)
{ {
...@@ -149,7 +149,7 @@ public class Menu : MonoBehaviour ...@@ -149,7 +149,7 @@ public class Menu : MonoBehaviour
} }
} }
} }
if (GamePad.GetButton(GamePad.Button.A, GamePad.Index.Four)) if (GamePad.GetButtonDown(GamePad.Button.A, GamePad.Index.Four))
{ {
if (GP4Added) if (GP4Added)
{ {
......
...@@ -82,7 +82,7 @@ public class PlayerInputMapping : MonoBehaviour { ...@@ -82,7 +82,7 @@ public class PlayerInputMapping : MonoBehaviour {
public bool isJumpPressed() public bool isJumpPressed()
{ {
if (usesGamepad) return GamePad.GetButton(GamePad.Button.A, gamepadIndex); if (usesGamepad) return GamePad.GetButtonDown(GamePad.Button.A, gamepadIndex);
else return Input.GetKey(keyCodes[(int)Keys.Jump]); else return Input.GetKey(keyCodes[(int)Keys.Jump]);
} }
...@@ -113,7 +113,7 @@ public class PlayerInputMapping : MonoBehaviour { ...@@ -113,7 +113,7 @@ public class PlayerInputMapping : MonoBehaviour {
if (usesGamepad) if (usesGamepad)
{ {
return (GamePad.GetTrigger(GamePad.Trigger.LeftTrigger, gamepadIndex) > 0.01f) || (GamePad.GetTrigger(GamePad.Trigger.RightTrigger, gamepadIndex) > 0.01f) return (GamePad.GetTrigger(GamePad.Trigger.LeftTrigger, gamepadIndex) > 0.01f) || (GamePad.GetTrigger(GamePad.Trigger.RightTrigger, gamepadIndex) > 0.01f)
|| GamePad.GetButton(GamePad.Button.LeftShoulder, gamepadIndex) || GamePad.GetButton(GamePad.Button.RightShoulder, gamepadIndex); || GamePad.GetButtonDown(GamePad.Button.LeftShoulder, gamepadIndex) || GamePad.GetButtonDown(GamePad.Button.RightShoulder, gamepadIndex);
} }
else return Input.GetKey(keyCodes[(int)Keys.Dash]); else return Input.GetKey(keyCodes[(int)Keys.Dash]);
} }
...@@ -122,7 +122,7 @@ public class PlayerInputMapping : MonoBehaviour { ...@@ -122,7 +122,7 @@ public class PlayerInputMapping : MonoBehaviour {
{ {
if (usesGamepad) if (usesGamepad)
{ {
return GamePad.GetButton(GamePad.Button.X, gamepadIndex) || GamePad.GetButton(GamePad.Button.Y, gamepadIndex); return GamePad.GetButtonDown(GamePad.Button.X, gamepadIndex) || GamePad.GetButtonDown(GamePad.Button.Y, gamepadIndex);
} }
else return Input.GetKey(keyCodes[(int)Keys.Shoot]); else return Input.GetKey(keyCodes[(int)Keys.Shoot]);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment