Created
August 15, 2014 11:16
-
-
Save domaemon/439f707424376526b92b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Assets/UnityChan2D/Scripts/UnityChan2DController.cs b/Assets/UnityChan2D/Scripts/UnityChan2DController.cs | |
index 0d76a83..1ef6e6b 100755 | |
--- a/Assets/UnityChan2D/Scripts/UnityChan2DController.cs | |
+++ b/Assets/UnityChan2D/Scripts/UnityChan2DController.cs | |
@@ -17,6 +17,10 @@ public class UnityChan2DController : MonoBehaviour | |
private State m_state = State.Normal; | |
+ public Joystick moveJoystick; | |
+ public Joystick touchJoystick; | |
+ private int prevTapCount = 0; | |
+ | |
void Reset() | |
{ | |
Awake(); | |
@@ -53,8 +57,15 @@ public class UnityChan2DController : MonoBehaviour | |
{ | |
if (m_state != State.Damaged) | |
{ | |
- float x = Input.GetAxis("Horizontal"); | |
- bool jump = Input.GetButtonDown("Jump"); | |
+ float x = moveJoystick.position.x; | |
+ bool jump = false; | |
+ | |
+ if (touchJoystick.IsFingerDown() && prevTapCount == 0 && touchJoystick.tapCount == 1) | |
+ { | |
+ jump = true; | |
+ } | |
+ prevTapCount = touchJoystick.tapCount; | |
+ | |
Move(x, jump); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment