Esempio n. 1
0
        /*
         * Button execution was broken out of the button handler so the
         * short cut keys can access it in a straight forward way
         */
        private void ButtonCommand(string btn)
        {
            bool executed = false;

            // prevent button hot keys during timer execution
            if (timerStep == 0)
            {
                Debug(btn + " pressed");

                switch (btn.ToUpper())
                {
                case "IMPL":
                    executed = Impulse.Execute();
                    break;

                case "WARP":
                    executed = Warp.Execute();

                    if (executed)
                    {
                        SRS.Execute();
                    }
                    break;

                case "SHLD":
                    Shields.Execute();
                    timerStep     = 4;
                    timer.Enabled = true;
                    //SetCondition();
                    break;

                case "POWER":
                    Shields.divertPower();
                    timerStep     = 4;
                    timer.Enabled = true;
                    //SetCondition();
                    break;

                case "TORP":
                    executed = Torpedoes.Execute();
                    break;

                case "PHAS":
                    executed = Phasers.Execute();
                    break;

                case "DMG":
                    DamageControl.FixAllDamage();
                    timerStep     = 4;
                    timer.Enabled = true;
                    //SetCondition();
                    break;
                }

                if (executed)
                {
                    // update status before animation starts
                    SetCondition();

                    if (IsUsingAnimation())
                    {
                        timerStep     = 1;
                        timer.Enabled = true;
                    }
                    else
                    {
                        Debug("No Animation Executing");
                        GameObjects.MoveWithNoAnimation();
                        GameObjects.TakingFire();
                        GameObjects.MoveWithNoAnimation();
                    }
                }
            }
        }