コード例 #1
0
ファイル: HeroControllerV2.cs プロジェクト: jperamak/Dada
    protected virtual void ProcessJump()
    {
        AbstractController _controller = _hero.PlayerInstance.Controller;

        /*
         * if (_controller.GetButtonDown(VirtualKey.JUMP) && Physics2D.Linecast(transform.position, transform.position  - _wallCheck.localPosition, 1 << LayerMask.NameToLayer("Ground")))
         * {
         *      _jumpStartTime = Time.time;
         *      _jump = true;
         *      _walljump = 1;
         *      //_anim.SetBool("Slide", true);
         * }
         *
         * else if (_controller.GetButtonDown(VirtualKey.JUMP) && Physics2D.Linecast(transform.position, transform.position + _wallCheck.localPosition, 1 << LayerMask.NameToLayer("Ground")))
         * {
         *      _jumpStartTime = Time.time;
         *      _jump = true;
         *
         *      _walljump = 2;
         *      //_anim.SetBool("Slide", true);
         * }
         * else
         * {
         *      _walljump = 0;
         * }*/
        if (_controller.GetButton(VirtualKey.JUMP))
        {
            _rigidbody.gravityScale = 0.9f;
            _jumpCloud.Play();
        }
        else
        {
            _rigidbody.gravityScale = 3.0f;
            _jumpCloud.Stop();
        }
        // If the jump button is pressed and the player is grounded then the player should jump.
        //Debug.Log (_rigidbody.velocity.y);


        //else if (_controller.GetButtonUp(VirtualKey.JUMP) || Time.time - _jumpStartTime > _hero.JumpLength )
        //	_jump = false;
    }