Skip to content

Instantly share code, notes, and snippets.

@domaemon
Created August 15, 2014 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domaemon/439f707424376526b92b to your computer and use it in GitHub Desktop.
Save domaemon/439f707424376526b92b to your computer and use it in GitHub Desktop.
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