Beispiel #1
0
        public override void use()
        {
            direction = weapon.creator.direction;
            int ammunitionNumber = weapon.ammunitionFor(WeaponTypes.missile) + 1;

            if (!isAI)
            {
                if (ammunitionNumber % 2 != 0)                                             //odd number means fire from right
                {
                    DSound.setPan(missileLaunchSound, (ammunitionNumber + 1) / 2 * 0.25f); //give 1 to ammunition number so we can divide properly; adding 1 will make it evenly divisible by 2.
                }
                else
                {
                    DSound.setPan(missileLaunchSound, ammunitionNumber / 2 * -0.25f);
                }
                fox = loadSound(soundPath + "fox2.wav");
                playSound(fox, true, false);
                DXInput.startFireEffect();
            }             //if !AI
            playSound(missileLaunchSound, true, false);
            if (origTarget != null)
            {
                z = origTarget.z;
                if (isAI && origTarget is Aircraft)
                {
                    ((Aircraft)origTarget).notifyOf(Notifications.missileLaunch, Degrees.getDistanceBetween(x, y, origTarget.x, origTarget.y) <= 15);
                }
            }
        }