コード例 #1
0
        public static void DebugUpdate()
        {
            #if DEBUG
            //Toggle debug
            if (Input.GetKey(Keys.LeftControl, DebugKeyboard) && Input.GetKeyDown(Keys.D, DebugKeyboard))
            {
                ToggleDebug();
            }
            #endif

            //Return if debug isn't enabled
            if (DebugEnabled == false)
            {
                if (Time.InGameTimeEnabled == false)
                {
                    Time.ToggleInGameTime(true);
                }

                //Update the input state if debug is disabled so that the toggle functions properly
                Input.UpdateInputState(ref DebugKeyboard);
                return;
            }

            //Reset frame advance
            AdvanceNextFrame = false;

            //Debug controls
            if (Input.GetKey(Keys.LeftControl, DebugKeyboard))
            {
                //Toggle pause
                if (Input.GetKeyDown(Keys.P, DebugKeyboard))
                {
                    DebugPaused = !DebugPaused;
                }
                //Toggle frame advance
                else if (Input.GetKeyDown(Keys.OemSemicolon, DebugKeyboard))
                {
                    AdvanceNextFrame = true;
                }
                //Toggle logs
                else if (Input.GetKeyDown(Keys.L, DebugKeyboard))
                {
                    ToggleLogs();
                }
                //Take screenshot
                else if (Input.GetKeyDown(Keys.S, DebugKeyboard))
                {
                    TakeScreenshot();
                }
                else if (Input.GetKeyDown(Keys.M, DebugKeyboard))
                {
                    //Log dump
                    DumpLogs();
                }
            }

            //Camera controls
            if (Input.GetKey(Keys.LeftShift, DebugKeyboard))
            {
                if (Input.GetKeyDown(Keys.Space, DebugKeyboard))
                {
                    //Reset camera coordinates
                    Camera.Instance.SetTranslation(Vector2.Zero);
                    Camera.Instance.SetRotation(0f);
                    Camera.Instance.SetZoom(1f);
                }
                else
                {
                    Vector2 translation = Vector2.Zero;
                    float   rotation    = 0f;
                    float   zoom        = 0f;

                    //Translation
                    if (Input.GetKey(Keys.Left, DebugKeyboard))
                    {
                        translation.X -= 2;
                    }
                    if (Input.GetKey(Keys.Right, DebugKeyboard))
                    {
                        translation.X += 2;
                    }
                    if (Input.GetKey(Keys.Down, DebugKeyboard))
                    {
                        translation.Y += 2;
                    }
                    if (Input.GetKey(Keys.Up, DebugKeyboard))
                    {
                        translation.Y -= 2;
                    }

                    //Rotation
                    if (Input.GetKey(Keys.OemComma, DebugKeyboard))
                    {
                        rotation -= .1f;
                    }
                    if (Input.GetKey(Keys.OemPeriod, DebugKeyboard))
                    {
                        rotation += .1f;
                    }

                    //Scale
                    if (Input.GetKey(Keys.OemMinus, DebugKeyboard))
                    {
                        zoom -= .1f;
                    }
                    if (Input.GetKey(Keys.OemPlus, DebugKeyboard))
                    {
                        zoom += .1f;
                    }

                    if (translation != Vector2.Zero)
                    {
                        Camera.Instance.Translate(translation);
                    }
                    if (rotation != 0f)
                    {
                        Camera.Instance.Rotate(rotation);
                    }
                    if (zoom != 0f)
                    {
                        Camera.Instance.Zoom(zoom);
                    }
                }
            }

            //Battle Debug
            if (Input.GetKey(Keys.RightShift, DebugKeyboard) == true)
            {
                DebugBattle();
            }

            //Unit Tests
            if (Input.GetKey(Keys.U, DebugKeyboard) == true)
            {
                DebugUnitTests();
            }

            //Damage Mario
            if (Input.GetKey(Keys.Tab, DebugKeyboard) == true)
            {
                if (Input.GetKeyDown(Keys.H) == true)
                {
                    //Make sure we damage the Shell instead if it's over Mario
                    BattleEntity entity = BattleManager.Instance.GetMario();
                    if (entity.EntityProperties.HasAdditionalProperty(Enumerations.AdditionalProperty.DefendedByEntity) == true)
                    {
                        entity = entity.EntityProperties.GetAdditionalProperty <BattleEntity>(Enumerations.AdditionalProperty.DefendedByEntity);
                    }

                    entity.TakeDamage(Enumerations.Elements.Normal, 1, true);
                }
            }

            //If a pause is eventually added that can be performed normally, put a check for it in here to
            //prevent the in-game timer from turning on when it shouldn't
            Time.ToggleInGameTime(DebugPaused == false || AdvanceNextFrame == true);

            FPSCounter.Update();
            Input.UpdateInputState(ref DebugKeyboard);
        }
コード例 #2
0
        public static void DebugUpdate()
        {
            #if DEBUG
            //Toggle debug
            if (Input.GetKey(Keys.LeftControl, DebugKeyboard) && Input.GetKeyDown(Keys.D, DebugKeyboard))
            {
                ToggleDebug();
            }
            #endif

            //Return if debug isn't enabled
            if (DebugEnabled == false)
            {
                if (Time.InGameTimeEnabled == false)
                {
                    Time.ToggleInGameTime(true);
                }
                return;
            }

            //Reset frame advance
            AdvanceNextFrame = false;

            //Debug controls
            if (Input.GetKey(Keys.LeftControl, DebugKeyboard))
            {
                //Toggle pause
                if (Input.GetKeyDown(Keys.P, DebugKeyboard))
                {
                    DebugPaused = !DebugPaused;
                }
                //Toggle frame advance
                else if (Input.GetKeyDown(Keys.OemSemicolon, DebugKeyboard))
                {
                    AdvanceNextFrame = true;
                }
                //Toggle logs
                else if (Input.GetKeyDown(Keys.L, DebugKeyboard))
                {
                    ToggleLogs();
                }
            }

            //Camera controls
            if (Input.GetKey(Keys.LeftShift, DebugKeyboard))
            {
                if (Input.GetKeyDown(Keys.Space, DebugKeyboard))
                {
                    //Reset camera coordinates
                    Camera.Instance.SetTranslation(Vector2.Zero);
                    Camera.Instance.SetRotation(0f);
                    Camera.Instance.SetZoom(1f);
                }
                else
                {
                    Vector2 translation = Vector2.Zero;
                    float   rotation    = 0f;
                    float   zoom        = 0f;

                    //Translation
                    if (Input.GetKey(Keys.Left, DebugKeyboard))
                    {
                        translation.X -= 2;
                    }
                    if (Input.GetKey(Keys.Right, DebugKeyboard))
                    {
                        translation.X += 2;
                    }
                    if (Input.GetKey(Keys.Down, DebugKeyboard))
                    {
                        translation.Y += 2;
                    }
                    if (Input.GetKey(Keys.Up, DebugKeyboard))
                    {
                        translation.Y -= 2;
                    }

                    //Rotation
                    if (Input.GetKey(Keys.OemComma, DebugKeyboard))
                    {
                        rotation -= .1f;
                    }
                    if (Input.GetKey(Keys.OemPeriod, DebugKeyboard))
                    {
                        rotation += .1f;
                    }

                    //Scale
                    if (Input.GetKey(Keys.OemMinus, DebugKeyboard))
                    {
                        zoom -= .1f;
                    }
                    if (Input.GetKey(Keys.OemPlus, DebugKeyboard))
                    {
                        zoom += .1f;
                    }

                    if (translation != Vector2.Zero)
                    {
                        Camera.Instance.Translate(translation);
                    }
                    if (rotation != 0f)
                    {
                        Camera.Instance.Rotate(rotation);
                    }
                    if (zoom != 0f)
                    {
                        Camera.Instance.Zoom(zoom);
                    }
                }
            }

            //Battle Debug
            if (Input.GetKey(Keys.RightShift, DebugKeyboard) == true)
            {
                DebugBattle();
            }

            //Unit Tests
            if (Input.GetKey(Keys.U, DebugKeyboard) == true)
            {
                DebugUnitTests();
            }

            //If a pause is eventually added that can be performed normally, put a check for it in here to
            //prevent the in-game timer from turning on when it shouldn't
            Time.ToggleInGameTime(DebugPaused == false || AdvanceNextFrame == true);

            FPSCounter.Update();
            Input.UpdateInputState(ref DebugKeyboard);
        }
コード例 #3
0
ファイル: Debug.cs プロジェクト: balmz/PaperMarioBattleSystem
        public static void DebugUpdate(BattleManager bManager)
        {
            //Toggle debug
            if (Input.GetKey(Keys.LeftControl, DebugKeyboard) && Input.GetKeyDown(Keys.D, DebugKeyboard))
            {
                ToggleDebug(!DebugEnabled);
            }

            //Return if debug isn't enabled
            if (DebugEnabled == false)
            {
                if (Time.InGameTimeEnabled == false)
                {
                    Time.ToggleInGameTime(true);
                }

                //Update the input state if debug is disabled so that the toggle functions properly
                Input.UpdateInputState(ref DebugKeyboard);
                return;
            }

            //Reset frame advance
            AdvanceNextFrame = false;

            //Debug controls
            if (Input.GetKey(Keys.LeftControl, DebugKeyboard))
            {
                //Toggle pause
                if (Input.GetKeyDown(Keys.P, DebugKeyboard))
                {
                    DebugPaused = !DebugPaused;
                }
                //Toggle frame advance
                else if (Input.GetKeyDown(Keys.OemSemicolon, DebugKeyboard))
                {
                    AdvanceNextFrame = true;
                }
                //Toggle logs
                else if (Input.GetKeyDown(Keys.L, DebugKeyboard))
                {
                    ToggleLogs(!LogsEnabled);
                }
                //Take screenshot
                else if (Input.GetKeyDown(Keys.S, DebugKeyboard))
                {
                    TakeScreenshot();
                }
                else if (Input.GetKeyDown(Keys.M, DebugKeyboard))
                {
                    //Log dump
                    DumpLogs();
                }
            }

            //Camera controls
            if (Input.GetKey(Keys.LeftShift, DebugKeyboard))
            {
                if (Input.GetKeyDown(Keys.Space, DebugKeyboard))
                {
                    //Reset camera coordinates
                    Camera.Instance.SetTranslation(Vector2.Zero);
                    Camera.Instance.SetRotation(0f);
                    Camera.Instance.SetZoom(1f);
                }
                else
                {
                    Vector2 translation = Vector2.Zero;
                    float   rotation    = 0f;
                    float   zoom        = 0f;

                    //Translation
                    if (Input.GetKey(Keys.Left, DebugKeyboard))
                    {
                        translation.X -= 2;
                    }
                    if (Input.GetKey(Keys.Right, DebugKeyboard))
                    {
                        translation.X += 2;
                    }
                    if (Input.GetKey(Keys.Down, DebugKeyboard))
                    {
                        translation.Y += 2;
                    }
                    if (Input.GetKey(Keys.Up, DebugKeyboard))
                    {
                        translation.Y -= 2;
                    }

                    //Rotation
                    if (Input.GetKey(Keys.OemComma, DebugKeyboard))
                    {
                        rotation -= .1f;
                    }
                    if (Input.GetKey(Keys.OemPeriod, DebugKeyboard))
                    {
                        rotation += .1f;
                    }

                    //Scale
                    if (Input.GetKey(Keys.OemMinus, DebugKeyboard))
                    {
                        zoom -= .1f;
                    }
                    if (Input.GetKey(Keys.OemPlus, DebugKeyboard))
                    {
                        zoom += .1f;
                    }

                    if (translation != Vector2.Zero)
                    {
                        Camera.Instance.Translate(translation);
                    }
                    if (rotation != 0f)
                    {
                        Camera.Instance.Rotate(rotation);
                    }
                    if (zoom != 0f)
                    {
                        Camera.Instance.Zoom(zoom);
                    }
                }
            }

            //Battle Debug
            if (Input.GetKey(Keys.RightShift, DebugKeyboard) == true)
            {
                DebugBattle(bManager);
            }

            //Unit Tests
            if (Input.GetKey(Keys.U, DebugKeyboard) == true)
            {
                DebugUnitTests();
            }

            if (Input.GetKey(Keys.Tab, DebugKeyboard) == true)
            {
                //Damage Mario
                if (Input.GetKeyDown(Keys.H) == true)
                {
                    //Make sure we damage the Shell instead if it's over Mario
                    BattleEntity entity = bManager.Mario.GetTrueTarget();

                    entity.TakeDamage(Enumerations.Elements.Normal, 1, true);
                }
                //Reload all animations
                //This can break Sequences that rely on animation timings
                else if (Input.GetKeyDown(Keys.R) == true)
                {
                    Debug.Log("Reloading all BattleEntity animations. Things may break if in a Sequence!");

                    List <BattleEntity> entities = new List <BattleEntity>();
                    bManager.GetAllBattleEntities(entities, null);

                    for (int i = 0; i < entities.Count; i++)
                    {
                        entities[i].LoadAnimations();
                    }
                }
                //Reverse flip state of all entities
                else if (Input.GetKeyDown(Keys.F) == true)
                {
                    List <BattleEntity> entities = new List <BattleEntity>();
                    bManager.GetAllBattleEntities(entities, null);

                    for (int i = 0; i < entities.Count; i++)
                    {
                        entities[i].SpriteFlip = !entities[i].SpriteFlip;
                    }
                }
            }

            //If a pause is eventually added that can be performed normally, put a check for it in here to
            //prevent the in-game timer from turning on when it shouldn't
            Time.ToggleInGameTime(DebugPaused == false || AdvanceNextFrame == true);

            FPSCounter.Update();
            Input.UpdateInputState(ref DebugKeyboard);
        }