Ejemplo n.º 1
0
    protected virtual void ProcessWeapons()
    {
        AbstractController _controller = _hero.PlayerInstance.Controller;

        //Use the ranged weapon from the muzzle
        if (_controller.GetButtonDown(VirtualKey.SHOOT))
        {
            _hero.RangedWeapon.OnTriggerDown();
        }
        else if (_controller.GetButtonUp(VirtualKey.SHOOT))
        {
            _hero.RangedWeapon.OnTriggerUp();
        }

        //use the melee weapon
        if (_controller.GetButtonDown(VirtualKey.MELEE))
        {
            _hero.MeleeWeapon.OnTriggerDown();
        }
        else if (_controller.GetButtonUp(VirtualKey.MELEE))
        {
            _hero.MeleeWeapon.OnTriggerUp();
        }
    }
Ejemplo n.º 2
0
    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 the jump button is pressed and the player is grounded then the player should jump.
        if (_controller.GetButtonDown(VirtualKey.JUMP) && _grounded)
        {
            _jumpStartTime = Time.time;
            _jumpStart     = true;
            _jump          = true;
        }
        else if (_controller.GetButtonUp(VirtualKey.JUMP) || Time.time - _jumpStartTime > _hero.JumpLength)
        {
            _jump = false;
        }
    }