Beispiel #1
0
        public void landPlayer()
        {
            playerLanded = true;
            Interaction.stopAndMute(true, true);
            moveSound.Stop();
            Common.fadeMusic();
            playMessage(DSound.SoundPath + "\\ac" + ((landedBefore) ? "6" : "5") + ".ogg");
            landedBefore = true;
            long mark = Environment.TickCount;

            ((Aircraft)Mission.player).rearm();
            ((Aircraft)Mission.player).restoreDamage(0);
            while (message.isPlaying())
            {
                if ((Environment.TickCount - mark) / 1000 >= 3 && (DXInput.isKeyHeldDown() || DXInput.isJSButtonHeldDown()))
                {
                    break;
                }
                Thread.Sleep(50);
            }
            message.stopOgg();
            playMessage(DSound.SoundPath + "\\ac7.ogg");
            while (message.isPlaying())
            {
                Thread.Sleep(500);
            }
            ((Aircraft)Mission.player).catapult();
            Common.startMusic();
            ((Aircraft)Mission.player).requestRefuel();
            playSound(moveSound, true, true);
            Interaction.resumeAndUnmute();
        }
Beispiel #2
0
        /// <summary>
        /// Says something through the speech source.
        /// </summary>
        /// <param name="sayString">The string to speak</param>
        /// <param name="flag">The way the string should be spoken. For example, if noInterrupt is passed, then the thread is halted until the message is finished speaking. See the flags enum for a description of each flag.</param>
        public static void speak(string sayString, SpeakFlag flag)
        {
            if (flag == SpeakFlag.interruptableButStop || flag == SpeakFlag.noInterruptButStop)
            {
                purge();
            }
            string sayStringW = processText(sayString);

            lastSpokenString = sayString;
            if (source == SpeechSource.auto)
            {
                if (initializeJAWS() && sayThroughJAWS(sayString, flag == SpeakFlag.interruptableButStop || flag == SpeakFlag.noInterruptButStop))
                {
                    startSpeakTimerOn(sayStringW);
                }
                else if (((Environment.Is64BitProcess) ? nvdaController64_speakText(sayString) : nvdaController_speakText(sayString)) == 0)
                {
                    startSpeakTimerOn(sayStringW);
                }
            }
            else
            {
                // if we got down here, none of the other screen readers are loaded or source is SAPI
                initialize();
                voice.SpeakAsync(sayString);
                // Wait for SAPI to actually begin speaking, otherwise we'll get a race condition where a query to isSpeaking will return false if
                // SAPI takes a little while to start speaking the string.
                while (!isSpeaking())
                {
                    Thread.Sleep(0);
                }
            }
            if (flag == SpeakFlag.none)
            {
                return;
            }
            if (flag == SpeakFlag.interruptable || flag == SpeakFlag.interruptableButStop)
            {
                while (DXInput.isKeyHeldDown() || DXInput.isJSButtonHeldDown())                   // So the loop doesn't break if we hold ENTER for too long.
                {
                    if (!isSpeaking())
                    {
                        break;
                    }
                    Thread.Sleep(0);
                }
            }
            while (isSpeaking())
            {
                if (flag == SpeakFlag.interruptable || flag == SpeakFlag.interruptableButStop)
                {
                    if (DXInput.isKeyHeldDown() || DXInput.isJSButtonHeldDown())
                    {
                        break;
                    }
                }
                Thread.Sleep(10);
            }
        }
Beispiel #3
0
 ////Returns true if another modifier for this same key assignment is pressed,
 ////false otherwise
 public static bool isModifierHeldFor(Aircraft.Action a)
 {
     if (keysData[(int)a - 1].modifier > 0)
     {
         if (DXInput.isKeyHeldDown((Key)keysData[(int)a - 1].modifier))
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #4
0
        public void move()
        {
            if (isAI)
            {
                throwMissile(Interaction.player);
                lockOnPerson(Interaction.player);
                if (shootTarget != null)
                {
                    shootPerson(shootTarget);
                }
                moveMissiles();
            }
            if (beingGrabbed)
            {
                return;
            }
            if (isStunned())
            {
                playSound(stunSound, false, true);
                return;
            }
            else if (DSound.isPlaying(stunSound))
            {
                stunSound.Stop();
            }
            if (isAI)
            {
                if (!isInPanicMode && (double)(damage / maxDamage) * 100 <= 40)
                {
                    isInPanicMode = true;
                }
                if (isInPanicMode)
                {
                    if (Common.getRandom(1, 100) <= 2)
                    {
                        seekRandomCoordinates();
                    }
                }
                if (isInRange(Interaction.player))
                {
                    if (grabTarget == null)
                    {
                        punchSomeone(Interaction.player, 50);
                        if (!seeking && !Interaction.player.isStunned())
                        {
                            if (grabSomeone(Interaction.player))
                            {
                                seekRandomFurniture();
                            }
                        }
                    }
                    else if (!seeking)                         //If someone's already being held.
                    {
                        if (Common.getRandom(1, 100) < 30)
                        {
                            letGoOfTarget();
                        }
                        else
                        {
                            tossTarget();
                            if (Common.getRandom(1, 2) == 1)
                            {
                                seekRandomCoordinates();
                            }
                        }
                    }
                }
                else                   //if not in range
                {
                    startSeeking(Interaction.player);
                }
                seek();
            }
            else                 //if not AI
            {
                if (DXInput.isFirstPress(Key.Space))
                {
                    punchSomeone(null, 100);
                }

                if (DXInput.isKeyHeldDown(Key.LeftShift) || DXInput.isKeyHeldDown(Key.RightShift))
                {
                    block();
                }
                else
                {
                    stopBlocking();
                }

                if (DXInput.isKeyHeldDown(Key.LeftControl) || DXInput.isKeyHeldDown(Key.RightControl))
                {
                    grabSomeone(null);
                }
                else if (grabTarget != null)
                {
                    tossTarget();
                }

                if (DXInput.isKeyHeldDown(Key.Up))
                {
                    move(Person.MovementDirection.north, DXInput.isFirstPress(Key.Up));
                }
                else if (DXInput.isKeyHeldDown(Key.Right))
                {
                    move(Person.MovementDirection.east, DXInput.isFirstPress(Key.Right));
                }
                else if (DXInput.isKeyHeldDown(Key.Down))
                {
                    move(Person.MovementDirection.south, DXInput.isFirstPress(Key.Down));
                }
                else if (DXInput.isKeyHeldDown(Key.Left))
                {
                    move(Person.MovementDirection.west, DXInput.isFirstPress(Key.Left));
                }
                if (DXInput.isFirstPress(Key.F6))
                {
                    decreaseMusicVolume();
                }
                if (DXInput.isFirstPress(Key.F7))
                {
                    increaseMusicVolume();
                }
            }
            if (swinging && (DateTime.Now - startSwingTime).TotalMilliseconds > 200)
            {
                doPunch();
            }
        }