Esempio n. 1
0
    /// <summary>
    /// Call when touch.phase = End
    /// </summary>
    /// <param name="touch"></param>
    public override void onTouchEnd(Touch touch)
    {
        base.onTouchEnd(touch);
        //calculate the jump power, by holding finger time.
        float holdFingerTime = Time.time - this.TouchStartTime;
        float JumpPower      = holdFingerTime / MaxHoldTime;

        //Min Power = 0.2f, Max Power = 1.
        JumpPower = Mathf.Clamp(JumpPower, 0.3f, 1);
        JumpController.PreJumpEnd();
        StartCoroutine(JumpController.Jump(JumpPower));
    }