예제 #1
0
    public void Attack()
    {
        switch (equippedWeapon.type)
        {
        // swinging weapons
        case Weapon.Type.Axe:
        case Weapon.Type.Sword:
            melee.Attack(equippedWeapon);
            break;

        // hurled weapons
        case Weapon.Type.Hammer:
        case Weapon.Type.Dagger:
            projectile.Fire(equippedWeapon);
            break;

        // magic projectile weapons
        case Weapon.Type.MagicProjectile:
            projectile.Fire(equippedWeapon);
            break;

        default:
            Assert.IsTrue(false, "** Default Case Reached **");
            break;
        }
    }
예제 #2
0
    // SWINGING WEAPONS — swords, axes, etc
    // mix & match animations and attacks for various activity states
    public void SwingWeapon(int action)
    {
        switch (action)
        {
        case IDLE:
        {
            equippedWeapon.PlayIdleAnimation(0, 0);
            arm.PlayIdleAnimation(0, 0);
            break;
        }

        case RUN:
        {
            equippedWeapon.PlayRunAnimation(0, 0);
            arm.PlayRunAnimation(0, 0);
            break;
        }

        case JUMP:
        {
            equippedWeapon.PlayJumpAnimation(0, 0);
            arm.PlayJumpAnimation(0, 0);
            break;
        }

        case FALL:
        {
            equippedWeapon.PlayJumpAnimation(0, 0);
            arm.PlayJumpAnimation(0, 0);
            break;
        }

        case ATTACK:
        {
            equippedWeapon.PlayAttackAnimation(0, 0);
            arm.PlayAttackAnimation(0, 0);
            melee.Attack(equippedWeapon);
            break;
        }

        case RUN_ATTACK:
        {
            equippedWeapon.PlayAttackAnimation(0, ONE_PIXEL);
            arm.PlayAttackAnimation(0, ONE_PIXEL);
            melee.Attack(equippedWeapon);
            break;
        }

        case JUMP_ATTACK:
        {
            equippedWeapon.PlayAttackAnimation(0, ONE_PIXEL * 2);
            arm.PlayAttackAnimation(0, ONE_PIXEL * 2);
            melee.Attack(equippedWeapon);
            break;
        }

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