Ejemplo n.º 1
0
    void HandleInput()
    {
        if (Input.GetButtonDown(inputmap[(int)InputMap.ButY]) && isAttacking &&
            barnAttack.state == AttackState.End)
        {
            barnAttack.EndAttack();
            Debug.Log("Cancel" + barnAttack.state);
        }
        if (!isAttacking)
        {
            Input.GetJoystickNames();
            var idx = Input.GetAxis(inputmap[(int)InputMap.Axis1X]);
            var idy = Input.GetAxis(inputmap[(int)InputMap.Axis1Y]);

            barnMove.Move(AxisRound(idx));
            var ijmpdown  = Input.GetButtonDown(inputmap[(int)InputMap.ButY]);
            var ijmpup    = Input.GetButtonUp(inputmap[(int)InputMap.ButY]);
            var ijmpstate = Input.GetButton(inputmap[(int)InputMap.ButY]);

//			if (ijmpup && !barnMove.jumpEnd) {
//				barnMove.jumpEnd = true;
//			}
            if (ijmpdown)
            {
                barnMove.JumpStart();
            }
            else if (ijmpstate)
            {
                barnMove.Jump();
            }

            var iattackdown = Input.GetButtonDown(inputmap[(int)InputMap.ButX]);
            if (iattackdown && !isAttacking && state != CharState.WallGrab && state != CharState.WallSlide)
            {
                animator.Animate("Attack");
                Debug.Log("Ide3");
                state = CharState.Idle;
                barnAttack.Attack();
            }

            var ibdown = Input.GetButtonDown(inputmap[(int)InputMap.ButB]);
            if (ibdown)
            {
                animator.Animate("Tele");
                GetComponent <BarnTele>().Teleport(new Vector2(idx, -idy));
            }

            if (idy > 0)
            {
                Debug.Log("let go");
                barnMove.LetGoWall();
            }
        }
    }
Ejemplo n.º 2
0
    private void HandleAnimation()
    {
        switch (controller.state)
        {
        case CharState.Idle:
            animator.Animate("Idle");
            break;

        case CharState.Moving:
            animator.Animate("Walk");
            break;

        case CharState.Jumping:
            animator.Animate("Jump");
            break;

        case CharState.WallGrab:
            animator.Animate("WallGrab");
            break;

        default:
            break;
        }
    }