protected Node Block(int blockTime)
 {
     return(new Sequence(
                new LeafInvoke(() =>
     {
         player.Block();
     }),
                new LeafWait(blockTime),
                new LeafInvoke(() =>
     {
         player.UnBlock();
     }),
                new LeafWait(100)
                ));
 }
Ejemplo n.º 2
0
    private void controlUpdate()
    {
        if (pb.CanNotMove)
        {
            return;
        }


        if ((CheckSide(Direction.Bottom) || jumpsLeft > 0) && pb.Keys.JumpButtonDown() && !jumping && canJump)
        {
            pb.animator.SetBool("Jumping", true);
            pb.animator.SetTrigger("Jumped");
        }

        if ((CheckSide(Direction.Bottom) && !jumping && !_jumping) || (VerticalVelocity > 0 && CheckSide(Direction.Top)) || KnockBack.y != 0)
        {
            VerticalVelocity = 0;
        }


        if (pb.Keys.AttackButtonDown())
        {
            Vector2 dir = new Vector2(lookDirection.y != 0 ? 0 : lookDirection.x, lookDirection.y);

            pb.RegularAttack(dir);
        }

        if (pb.Keys.SpecialAttackButtonDown())
        {
            pb.SpecialAttack();
        }

        if (pb.Keys.BlockButtonDown())
        {
            pb.Block();
        }
    }