Ejemplo n.º 1
0
 //Alfred Lai - Custom joystick function
 float joyStickInput(MPJoystick joystick)
 {
     Vector2 absJoyPos = new Vector2(Mathf.Abs(joystick.position.x),
                                Mathf.Abs(joystick.position.y));
     float xDirection = (joystick.position.x > 0) ? 1 : -1;
     float yDirection = (joystick.position.y > 0) ? 1 : -1;
     return ((absJoyPos.x > absJoyPos.y) ? absJoyPos.x * xDirection : absJoyPos.y * yDirection);
 }
Ejemplo n.º 2
0
 void Awake()
 {
     myAnimator   = GetComponent <Animator>();
     myTransform  = transform;
     JoyHandle    = GameObject.FindGameObjectWithTag("JoyHandle");
     moveJoystick = JoyHandle.transform.FindChild("Joy").GetComponent <MPJoystick>();
     joyJump      = JoyHandle.transform.FindChild("jump");
 }
Ejemplo n.º 3
0
    private float tapTimeWindow; // How much time there is left for a tap to occur

    #endregion Fields

    #region Methods

    public static MPJoystick Get()
    {
        if (m_Instance == null)
            m_Instance = (MPJoystick)FindObjectOfType(typeof(MPJoystick));
        return m_Instance;
    }