Ejemplo n.º 1
0
 /// <summary>
 /// Test camera
 /// </summary>
 public static void TestCamera()
 {
     Model carModel = null;
     TestGame.Start("TestCamera",
         delegate // Init
         {
             carModel = new Model("Car");
         },
         delegate // Render loop
         {
             // Just show background ... free camera is handled automatically.
             RacingGameManager.UI.RenderGameBackground();
             carModel.RenderCar(1, Color.White, false, Matrix.Identity);
         });
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Test car model
        /// </summary>
        public static void TestCarModel()
        {
            bool shadowCarMode = false;
            int carType = 0;
            Model testModel = null;

            TestGame.Start("TestCarModel",
                delegate
                {
                    testModel = new Model("Car");
                },
                delegate
                {
                    BaseGame.UI.RenderGameBackground();

                    RacingGameManager.Player.SetCarWheelPos(
                        BaseGame.TotalTime * 12.0f);
                    testModel.RenderCar(carType,
                        RacingGameManager.CarColor,
                        shadowCarMode,
                        Matrix.Identity);

                    TextureFont.WriteText(20, 30,
                        "Press Space to toggle shadow car mode: " +
                        shadowCarMode);
                    TextureFont.WriteText(20, 60,
                        "Press Left/Right to toggle car type: " +
                        carType);
                    TextureFont.WriteText(20, 90,
                        "Press Up/Down to toggle car color: " +
                        RacingGameManager.currentCarColor);
                    if (Input.KeyboardSpaceJustPressed ||
                        Input.GamePadAJustPressed)
                        shadowCarMode = !shadowCarMode;
                    if (Input.KeyboardLeftJustPressed ||
                        Input.GamePadLeftJustPressed)
                        carType = (carType + 2) % RacingGameManager.NumberOfCarTextureTypes;
                    if (Input.KeyboardRightJustPressed ||
                        Input.GamePadRightJustPressed)
                        carType = (carType + 1) % RacingGameManager.NumberOfCarTextureTypes;
                    if (Input.KeyboardUpJustPressed ||
                        Input.GamePadUpJustPressed)
                        RacingGameManager.currentCarColor =
                            (RacingGameManager.currentCarColor + 1) %
                            RacingGameManager.NumberOfCarColors;
                    if (Input.KeyboardDownJustPressed ||
                        Input.GamePadDownJustPressed)
                        RacingGameManager.currentCarColor =
                            (RacingGameManager.currentCarColor +
                            RacingGameManager.NumberOfCarColors - 1) %
                            RacingGameManager.NumberOfCarColors;
                });
        }