Exemplo n.º 1
0
    // void AttackWhileJumpingBUG()
    // {
    //  velocity.y = Mathf.Sqrt(2f * jumpHeight * -gravity);

    //  action = Action.JumpAttack;

    //  jump = false;

    //  attack = false;
    // }

    // mix & match animations for various activity states,
    // and pass instructions on to WeaponManager
    void ActionDispatcher()
    {
        switch (action)
        {
        case Action.Idle:
        {
            animator.speed = IDLE_SPEED;
            animator.Play(Animator.StringToHash(idleAnimation));
            weaponManager.ActionDispatcher(IDLE);
            break;
        }

        case Action.Run:
        {
            animator.speed = RUN_SPEED;
            animator.Play(Animator.StringToHash(runAnimation));
            weaponManager.ActionDispatcher(RUN);
            break;
        }

        case Action.Jump:
        {
            animator.speed = JUMP_SPEED;
            animator.Play(Animator.StringToHash(jumpAnimation));
            weaponManager.ActionDispatcher(JUMP);
            break;
        }

        case Action.Fall:
        {
            animator.speed = JUMP_SPEED;
            animator.Play(Animator.StringToHash(jumpAnimation));
            weaponManager.ActionDispatcher(FALL);
            break;
        }

        case Action.Attack:
        {
            animator.speed = SWING_SPEED;
            animator.Play(Animator.StringToHash(attackAnimation));
            weaponManager.ActionDispatcher(ATTACK);
            break;
        }

        case Action.RunAttack:
        {
            animator.speed = RUN_SPEED;
            animator.Play(Animator.StringToHash(runAnimation));
            weaponManager.ActionDispatcher(RUN_ATTACK);
            break;
        }

        case Action.JumpAttack:
        {
            animator.speed = JUMP_SPEED;
            animator.Play(Animator.StringToHash(jumpAnimation));
            weaponManager.ActionDispatcher(JUMP_ATTACK);
            break;
        }

        default:
        {
            Assert.IsTrue(false, "** Default Case Reached **");
            break;
        }
        }
    }