Пример #1
0
        static void Main(string[] args)
        {
            //TestGame.Main();
            var game = new TestGame(79, 24);

            game.GameLoop();
        }
        public void ProcessInput(TestGame testGameInstance, GameTime gameTime)
        {
            _testGameInstance = testGameInstance;

            ProcessInputForGame();

            _oldMouseState = Mouse.GetState();
        }
        public void ProcessInput(TestGame testGameInstance, GameTime gameTime)
        {
            _testGameInstance = testGameInstance;

            ProcessInputForMenu();

            _oldKeyboardState = Keyboard.GetState();
        }
Пример #4
0
 public TransparencyTest(IKernel kernel, TestGame game, ContentManager content, GraphicsDevice device)
     : base("Transparency", kernel)
 {
     _kernel = kernel;
     _content = content;
     _device = device;
     _game = game;
     _batch = new SpriteBatch(device);
 }
        public void TestFixtureSetup()
        {
            this.game = new TestGame();
            this.gameThread = new Thread(new ThreadStart(game.Run));
            this.gameThread.Start();

            // I need to give the game enough time to initialise before letting the tests continue
            System.Threading.Thread.Sleep(200);
        }
Пример #6
0
        public void Constructor_GivenNullRules_ThrowsException()
        {
            // arrange
            TestGame game;

            // act:ish
            Action action = () => game = new TestGame(null);

            // assert
            AssertExtension.Throws<ArgumentNullException>(action);
        }
Пример #7
0
 public Demo(
     IKernel kernel,
     TestGame game,
     ContentManager content,
     GraphicsDevice device)
     : base("Demo", kernel)
 {
     _kernel = kernel;
     _content = content;
     _game = game;
 }
Пример #8
0
        public void RunThrough_GivenInteger_StepsForwardInTime()
        {
            // arrange
            var game = new TestGame(new StandardRules());

            // act
            game.RunThrough(10);

            // assert
            Assert.AreEqual(
                expected: 10,
                actual: game.Generation,
                message: "Game did not step forward correctly.");
        }
Пример #9
0
        public void Rules_WhenAccessed_ReturnsObjectPassedToConstructor()
        {
            // arrange
            var rules = new StandardRules();
            var game = new TestGame(rules);

            // act
            var property = game.Rules;

            // assert
            Assert.AreSame(
                expected: rules,
                actual: property,
                message: "Wrong rules reference returned by property.");
        }
Пример #10
0
        public void Game_Run_Test()
        {
            var game = new TestGame();

            bool initializedFired = false, updateFired = false, drawFired = false, exitingFired = false;
            game.Initialized += ((o, e) => initializedFired = true);
            game.Updated += ((o, e) => updateFired = true);
            game.Exiting += ((o, e) => exitingFired = true);
            game.Drew += ((o, e) => drawFired = true);
            game.Run();

            Assert.IsTrue(initializedFired);
            Assert.IsTrue(updateFired);
            Assert.IsTrue(exitingFired);
            Assert.IsTrue(drawFired);
        }
Пример #11
0
        public Demo(
            IKernel kernel,
            TestGame game,
            ContentManager content,
            GraphicsDevice device)
            : base("Demo", kernel)
        {
            this.kernel = kernel;
            this.content = content;
            this.device = device;
            this.game = game;

            //aviManager = new AviManager(@"demo.avi", false);

            //timeline = new DefaultTimeline(framesPerSecond);
            //timeline.AddAudioGroup("main");
            //videoGroup = timeline.AddVideoGroup("main", framesPerSecond, 32, width, height);
            //videoTrack = videoGroup.AddTrack();
        }
Пример #12
0
        private void InitializeGame()
        {
            try
            {
                _context.Entry(game).State = EntityState.Detached;
            }
            catch (Exception)
            {
                // TODO: nothing...
            }

            game = new TestGame()
            {
                GameId          = 200,
                GameStatusCode  = "A",
                GameCategoryId  = 1,
                GamePlatformId  = 1,
                GameName        = "Testing Game",
                GameDescription = "Testing description for Testing Game",
                GamePrice       = 9.99m,
                GameQty         = 100,
                GameDigitalPath = @"\download\200"
            };
        }
Пример #13
0
        private void runGameWithLogic(Action <Game> logic, Func <Game, bool> exitCondition = null)
        {
            Storage storage = null;

            try
            {
                using (var host = new HeadlessGameHost($"{GetType().Name}-{Guid.NewGuid()}", realtime: false))
                {
                    storage = host.Storage;
                    using (var game = new TestGame())
                    {
                        game.Schedule(() => logic(game));
                        host.UpdateThread.Scheduler.AddDelayed(() =>
                        {
                            if (exitCondition?.Invoke(game) == true)
                            {
                                host.Exit();
                            }
                        }, 0, true);

                        host.Run(game);
                    }
                }
            }
            finally
            {
                try
                {
                    storage?.DeleteDirectory(string.Empty);
                }
                catch
                {
                    // May fail due to the file handles still being open on Windows, but this isn't a big problem for us
                }
            }
        }
Пример #14
0
        public void UpdateLoopCatchupForFixedTimeStepGameWhereStepRateExceedsMAX_ELAPSEDTest()
        {
            const int LOOP_COUNT         = 5;
            const int STEP_RATE          = 1000; // milliseconds per step
            const int TARGET_UPDATE_RATE = 100;  // update called every 100 ms

            Assert.Greater((double)STEP_RATE, (double)TestClock.MAX_ELAPSED, "STEP_RATE should be greater than TestClock.MAX_ELAPSED for this test");

            DelegateBasedEventSource evt = new DelegateBasedEventSource(delegate(DelegateBasedEventSource e)
            {
                int i = LOOP_COUNT;
                while (i-- > 0)
                {
                    TestClock.Instance.Step(STEP_RATE);
                    e.Game.Tick();
                }
            });
            TestGame gd = new TestGame(evt, true);

            gd.TargetElapsedTime = TimeSpan.FromMilliseconds(TARGET_UPDATE_RATE);
            gd.Run();

            Assert.AreEqual(1 + LOOP_COUNT * TestClock.MAX_ELAPSED / TARGET_UPDATE_RATE, gd.CountUpdate);
        }
Пример #15
0
        public void DrawCalledWhenIDrawableGameComponentIsVisibleTest()
        {
            DelegateBasedEventSource evt = new DelegateBasedEventSource(delegate(DelegateBasedEventSource e)
            {
                DrawableGameComponentTestBase u = (DrawableGameComponentTestBase)e.Game.Components[0];
                for (int i = 1; i < 6; i++)
                {
                    TestClock.Instance.Step(100);
                    e.Game.Tick();
                    u.Visible = i % 2 == 0;
                }
            });
            TestGame game = new TestGame(evt);

            ((TestGameWindow)game.Window).RaiseVisibleChanged(true);
            DrawableGameComponentTestBase gc = new DrawableGameComponentTestBase(game);

            game.Components.Add(gc);

            game.Run();

            Assert.AreEqual(3, gc.CountDraw, "Unexpected draw count");
            Assert.AreEqual(6, gc.CountUpdate, "Unexpected update count");
        }
Пример #16
0
        public void UpdateLoopForVariableTimeStepGameTest()
        {
            const int LOOP_COUNT         = 5;
            const int STEP_RATE          = 50;  // milliseconds per step
            const int TARGET_UPDATE_RATE = 100; // update called every 100 ms

            DelegateBasedEventSource evt = new DelegateBasedEventSource(delegate(DelegateBasedEventSource e)
            {
                int i = LOOP_COUNT;
                while (i-- > 0)
                {
                    TestClock.Instance.Step(STEP_RATE);
                    e.Game.Tick();
                }
            });
            TestGame gd = new TestGame(evt, true);

            gd.TargetElapsedTime = TimeSpan.FromMilliseconds(TARGET_UPDATE_RATE);
            gd.IsFixedTimeStep   = false;
            ((TestGameWindow)gd.Window).RaiseVisibleChanged(true);

            gd.Run();
            Assert.AreEqual(gd.CountUpdate, gd.CountDraw + 1);
        }
Пример #17
0
        public void DrawNotCalledOnNonVisibleIDrawableGameComponent()
        {
            DelegateBasedEventSource evt = new DelegateBasedEventSource(delegate(DelegateBasedEventSource e) { e.Game.Tick(); });
            TestGame game = new TestGame(evt);
            ((TestGameWindow)game.Window).RaiseVisibleChanged(true);

            DrawableGameComponentTestBase gc = new DrawableGameComponentTestBase(game);
            game.Components.Add(gc);
            gc.Visible = false;

            game.Run();

            Assert.AreEqual(0, gc.CountDraw);
        }
Пример #18
0
 private void load(TestGame game)
 {
     blockingClose = game.BlockExit.GetBoundCopy();
 }
Пример #19
0
 public LightingTest(TestGame game, int width, int height)
     : base(game, width, height)
 {
 }
Пример #20
0
 public void InitializeGraphicsTest()
 {
     Game = new TestGame();
 }
Пример #21
0
 public Pad(TestGame game)
     : base(game)
 {
 }
Пример #22
0
 public Player(TestGame game) : base(game)
 {
 }
Пример #23
0
 public Goat(TestGame game, int width, int height)
     : base(game, width, height)
 {
 }
Пример #24
0
        public void IsFixedTimeStepDefaultTrueTest()
        {
            TestGame game = new TestGame();

            Assert.IsTrue(game.IsFixedTimeStep, "IsFixedTimeStep should be true");
        }
Пример #25
0
        public void IsActiveDefaultTrueTest()
        {
            TestGame game = new TestGame();

            Assert.IsTrue(game.IsActive, "IsActive should be true");
        }
Пример #26
0
        public void Constructors()
        {
            TestGame game = new TestGame();

            Assert.IsNotNull(game, "Failed to create TestGame");
        }
Пример #27
0
        public TestWindow()
        {
            Game = new TestGame();

            InitializeComponent();
        }
Пример #28
0
        public void UpdateCalledOnceForIUpdatableGameComponent()
        {
            DelegateBasedEventSource evt = new DelegateBasedEventSource(delegate(DelegateBasedEventSource e)
                                                                            {
                                                                                GameComponentTestBase u = (GameComponentTestBase)e.Game.Components[0];
                                                                                u.Enabled = false;
                                                                                for (int i = 0; i < 5; i++)
                                                                                {
                                                                                    TestClock.Instance.Step(100);
                                                                                    e.Game.Tick();
                                                                                }
                                                                            });
            TestGame game = new TestGame(evt);
            GameComponentTestBase gc = new GameComponentTestBase(game);
            game.Components.Add(gc);

            game.Run();

            Assert.AreEqual(1, gc.CountUpdate);
        }
 public void Init()
 {
     game = new TestGame(true);
     components = game.Components;
 }
Пример #30
0
 public ParticleLight (TestGame game, int width, int height)
     : base(game, width, height) {
 }
Пример #31
0
 private void Awake()
 {
     Ins      = this;
     m_update = gameObject.GetComponent <UpdateResFromServer>();
     m_update.Init();
 }
Пример #32
0
        private static void DeviceFound(object sender, DeviceEventArgs args)
        {
            INatDevice       device = args.Device;
            IGamePortMapping gamePortMapping;

            switch (Mode)
            {
            case Mode.ADD:
            case Mode.REMOVE:
                if (GameName == "TestGame")
                {
                    //Tweak pour load l'assembly
                    gamePortMapping = new TestGame();
                }
                else
                {
                    gamePortMapping = (IGamePortMapping)AssemblyLoader.GetInstanceOfGameMapping(GameName);
                }

                if (gamePortMapping == null)
                {
                    Console.WriteLine("Le jeu " + GameName + " n'a pas été trouvé, veuillez réessayer.");
                    System.Environment.Exit(1);
                }

                Console.WriteLine(gamePortMapping.Description());

                if (Mode == Mode.REMOVE)
                {
                    Console.WriteLine("Le système va tenter de supprimer ces ports de la table NAT");
                }
                else
                {
                    Console.WriteLine("Le système va tenter d'ajouter ces ports de la table NAT");
                }

                Console.WriteLine("Appliquer ? [O]/N");
                String res = Console.ReadLine();

                if (res.ToLower().Equals("n"))
                {
                    System.Environment.Exit(0);
                }

                GamePortMappingApplier applier = new GamePortMappingApplier(gamePortMapping);

                if (Mode == Mode.ADD)
                {
                    applier.AddRules(device);
                    Console.WriteLine("Les ports sont bien ajoutés, le système reste ouvert et va se relancer toutes les 500 secondes");
                    Console.WriteLine("CTRL+C pour quitter");
                }
                else
                {
                    applier.RemoveRules(device);
                    Environment.Exit(0);
                }
                break;

            case Mode.LISTPORT:
                var routerTable = device.GetAllMappings();
                foreach (Mapping m in routerTable)
                {
                    Console.WriteLine(m.ToString());
                }
                Environment.Exit(0);
                break;


            default:
                break;
            }
        }
Пример #33
0
 //Initializes variables
 void Awake()
 {
     game = FindObjectOfType <TestGame>().GetComponent <TestGame>();
 }
Пример #34
0
 internal TestGame Create(TestGame newGame)
 {
     _repo.Create(newGame);
     return(newGame);
 }
Пример #35
0
 public void Constructors()
 {
     TestGame game = new TestGame();
     Assert.IsNotNull(game, "Failed to create TestGame");
 }
Пример #36
0
 public ResultGameState(TestGame game)
 {
     this.game = game;
 }
Пример #37
0
 public void Init()
 {
     game       = new TestGame(true);
     components = game.Components;
 }
Пример #38
0
 public void GameWindowSetTest()
 {
     TestGame game = new TestGame();
     Assert.IsNotNull(game.Window, "Window is not set");
     Assert.IsInstanceOfType(typeof (TestGameWindow), game.Window);
 }
Пример #39
0
        static void Main(string[] args)
        {
            var fieldGenerator = new PreciseFieldGenerator(new PreciseFieldGeneratorParams(-690520614, 20));
            int width = 10, height = 10;
            var game = new TestGame(fieldGenerator, width, height);

            markX = 0;
            markY = 0;
            PrintField(width, height, game.Field);
            while (true)
            {
                var key = System.Console.ReadKey();

                switch (key.Key)
                {
                case ConsoleKey.UpArrow:
                {
                    if (markX == 0)
                    {
                        break;
                    }

                    markX--;
                    Reprint(width, height, game.Field);
                    break;
                }

                case ConsoleKey.DownArrow:
                {
                    if (markX >= width - 1)
                    {
                        break;
                    }

                    markX++;
                    Reprint(width, height, game.Field);
                    break;
                }

                case ConsoleKey.LeftArrow:
                {
                    if (markY == 0)
                    {
                        break;
                    }

                    markY--;
                    Reprint(width, height, game.Field);
                    break;
                }

                case ConsoleKey.RightArrow:
                {
                    if (markY >= height - 1)
                    {
                        break;
                    }

                    markY++;
                    Reprint(width, height, game.Field);
                    break;
                }

                case ConsoleKey.F:
                {
                    game.MakeMove(new Move(markX, markY, Data.MoveType.Flag));
                    Reprint(width, height, game.Field);
                    break;
                }

                case ConsoleKey.Enter:
                {
                    var result = game.MakeMove(new Move(markX, markY, Data.MoveType.Click));
                    Reprint(width, height, game.Field);
                    switch (result.ResultType)
                    {
                    case Enums.MoveResultType.GameOver:
                        System.Console.WriteLine("Game over.");
                        break;

                    case Enums.MoveResultType.Victory:
                        System.Console.WriteLine("Victory");
                        break;

                    case Enums.MoveResultType.Opened:
                        System.Console.WriteLine(string.Join(", ", result.OpenedCells.Select(x => $"{x.X}: {x.Y}")));
                        break;
                    }
                    break;
                }

                default: return;
                }
            }
        }
Пример #40
0
        public void DrawCalledWhenIDrawableGameComponentIsVisibleTest()
        {
            DelegateBasedEventSource evt = new DelegateBasedEventSource(delegate(DelegateBasedEventSource e)
                                                                            {
                                                                                DrawableGameComponentTestBase u = (DrawableGameComponentTestBase)e.Game.Components[0];
                                                                                for (int i = 1; i < 6; i++)
                                                                                {
                                                                                    TestClock.Instance.Step(100);
                                                                                    e.Game.Tick();
                                                                                    u.Visible = i%2 == 0;
                                                                                }
                                                                            });
            TestGame game = new TestGame(evt);
            ((TestGameWindow)game.Window).RaiseVisibleChanged(true);
            DrawableGameComponentTestBase gc = new DrawableGameComponentTestBase(game);
            game.Components.Add(gc);

            game.Run();

            Assert.AreEqual(3, gc.CountDraw, "Unexpected draw count");
            Assert.AreEqual(6, gc.CountUpdate, "Unexpected update count");
        }
Пример #41
0
 public RampTest(TestGame game, int width, int height)
     : base(game, width, height)
 {
 }
Пример #42
0
        public void TestComponents()
        {
            var testGame = new TestGame();
            testGame.OnInitialized += game =>
            {
                var sw = new Stopwatch();
                sw.Start();

                var manager = game.GameObjectManager;

                // Expect there to be 0 game objects.
                Assert.AreEqual(0, manager.GameObjects.Count, "Expected 0 root objects.");

                var go = game.AddGameObject();
                var child = go.AddObject();

                // Expect there to be 1 root game object and 1 child in go.
                Assert.AreEqual(1, manager.GameObjects.Count, "Expected 1 root object.");
                Assert.AreEqual(1, go.Children.Count, "Expected 1 child object.");

                // Expect go's name to be the name of the class.
                Assert.AreEqual(typeof(GameObject).Name, go.Name, "Expected root object's name to be 'GameObject'.");
                Assert.AreEqual(typeof(GameObject).Name, child.Name, "Expected child's name to be 'GameObject'.");

                // Expect object's sibling count to be 1.
                Assert.AreEqual(1, go.Siblings.Count, "Expected root object's siblings count to be 1.");
                Assert.AreEqual(1, child.Siblings.Count, "Expected child object's siblings count to be 1.");

                var child2 = go.AddObject();

                // Expect root object's sibling count to be 2.
                Assert.AreEqual(1, go.Siblings.Count, "Expected root object's siblings count to be 1.");
                Assert.AreEqual(2, child.Siblings.Count, "Expected child object's siblings count to be 2.");
                Assert.AreEqual(2, go.Children.Count, "Expected root object's children count to be 2.");

                // Expect object component count to be 1 and for it to have a Transform component.
                Assert.AreEqual(1, go.Components.Count, "Expected object's Component count to be 1.");
                Assert.AreEqual(typeof(Transform), go.GetComponent<Transform>()?.GetType(), "Expected object to have a Transform component.");

                // Expect object to be enabled and visible.
                Assert.AreEqual(true, go.Enabled, "Expected object to be Enabled.");
                Assert.AreEqual(true, go.Visible, "Expected object to be visible.");

                // Expect every component to be enabled.
                Assert.IsTrue(go.Components.All(comp => comp.Value.Enabled), "Expected all components to be enabled.");

                go.Enabled = false;

                // Expect every component to be disabled.
                Assert.IsTrue(go.Components.All(comp => !comp.Value.Enabled), "Expected all components to be disabled.");

                go.Enabled = true;

                // Expect every component to be enabled.
                Assert.IsTrue(go.Components.All(comp => comp.Value.Enabled), "Expected all components to be enabled.");

                child.Destroy();

                // Expect there to be 1 child object and for child to be destroyed.
                Assert.AreEqual(1, go.Children.Count, "Expected 1 child object.");
                Assert.AreEqual(true, child.Destroyed, "Expected child to be destroyed.");
                Assert.AreEqual(0, child.Components.Count, "Expected destroyed object to have 0 components.");

                go.Destroy();

                // Expect there to be 0 objects and for Object to be destroyed.
                Assert.AreEqual(0, manager.GameObjects.Count, "Expected 0 root objects.");
                Assert.AreEqual(true, go.Destroyed, "Expected object to be destroyed.");

                // Test cloning
                go = game.AddGameObject();
                var clone = go.Clone();

                // Expect clone name to be 'GameObject (Clone)'
                Assert.AreEqual(go.Name + " (Clone)", clone.Name, "Expected clone's name to be original name plus ' (Clone)'.");

                // Test setting properties
                var component = go.AddComponent<TestComponent>();
                Assert.AreEqual("default", component.TestString, "Expected default TestString value to equal 'default'.");

                go.RemoveComponent<TestComponent>();
                component = go.AddComponent<TestComponent>(new { TestString = "custom" });
                Assert.AreEqual("custom", component.TestString, "Expected custom TestString value to equal 'custom'.");

                // Expect clones to not equal the original object.
                Assert.AreNotEqual(go, clone, "Expected clone to be separate instance");
                Assert.IsTrue(go.Components.Values.All(comp => !clone.Components.ContainsValue(comp)), "Expected cloned components to be separate instances from original components.");
                Assert.IsTrue(go.Children.All(_child => !clone.Children.Contains(_child)), "Expected cloned children to be separate instances from original children.");

                Console.WriteLine(game.ToHierarchyString());

                game.GameObjectManager.Destroy();

                // Expect there to be 0 objects.
                Assert.AreEqual(0, game.GameObjectManager.GameObjects.Count, "Expected total root objects count to be 0.");

                sw.Stop();
                Console.WriteLine("TestComponents took " + sw.Elapsed.TotalMilliseconds + " ms.");
            };
            testGame.RunOneFrame();
        }
        }         // ResetRenderTarget(fullResetToBackBuffer)

        #endregion

        #region Unit Testing
#if DEBUG
        /// <summary>
        /// Test create render to texture
        /// </summary>
        static public void TestCreateRenderToTexture()
        {
            Model           testModel       = null;
            RenderToTexture renderToTexture = null;

            TestGame.Start(
                "TestCreateRenderToTexture",
                delegate
            {
                testModel       = new Model("asteroid1");
                renderToTexture = new RenderToTexture(
                    //SizeType.QuarterScreen);
                    SizeType.HalfScreen);
                //SizeType.HalfScreenWithZBuffer);
                //SizeType.FullScreen);
                //SizeType.ShadowMap);
            },
                delegate
            {
                bool renderToTextureWay =
                    Input.Keyboard.IsKeyUp(Keys.Space) &&
                    Input.GamePadAPressed == false;
                BaseGame.Device.RenderState.DepthBufferEnable = true;

                if (renderToTextureWay)
                {
                    // Set render target to our texture
                    renderToTexture.SetRenderTarget();

                    // Clear background
                    renderToTexture.Clear(Color.Blue);

                    // Draw background lines
                    //Line.DrawGrid();
                    //Ui.LineManager.RenderAll3DLines();

                    // And draw object
                    testModel.Render(Matrix.CreateScale(7.5f));
                    //BaseGame.RenderManager.RenderAllMeshes();

                    // Do we need to resolve?
                    renderToTexture.Resolve(true);
                    //BaseGame.Device.ResolveRenderTarget(0);

                    // Reset background buffer
                    //not longer required, done in Resolve now:
                    //RenderToTexture.ResetRenderTarget(true);
                }                         // if (renderToTextureWay)
                else
                {
                    // Copy backbuffer way, render stuff normally first
                    // Clear background
                    BaseGame.Device.Clear(Color.Blue);

                    // Draw background lines
                    //Line.DrawGrid();
                    //Ui.LineManager.RenderAll3DLines();

                    // And draw object
                    testModel.Render(Matrix.CreateScale(7.5f));
                    //BaseGame.RenderManager.RenderAllMeshes();
                }                         // else

                // Show render target in a rectangle on our screen
                renderToTexture.RenderOnScreen(
                    //tst:
                    new Rectangle(100, 100, 256, 256));
                //BaseGame.ScreenRectangle);
                //no need: BaseGame.UI.FlushUI();

                TextureFont.WriteText(2, 0,
                                      "               Press Space to toogle full screen rendering");
                TextureFont.WriteText(2, 30,
                                      "renderToTexture.Width=" + renderToTexture.Width);
                TextureFont.WriteText(2, 60,
                                      "renderToTexture.Height=" + renderToTexture.Height);
                TextureFont.WriteText(2, 90,
                                      "renderToTexture.Valid=" + renderToTexture.IsValid);
                TextureFont.WriteText(2, 120,
                                      "renderToTexture.XnaTexture=" + renderToTexture.XnaTexture);
                TextureFont.WriteText(2, 150,
                                      "renderToTexture.ZBufferSurface=" + renderToTexture.ZBufferSurface);
                TextureFont.WriteText(2, 180,
                                      "renderToTexture.Filename=" + renderToTexture.Filename);
            });
        }         // TestCreateRenderToTexture()
 public QuestionGameState(TestGame game)
 {
     this.game = game;
 }
Пример #45
0
 public void IsActiveDefaultTrueTest()
 {
     TestGame game = new TestGame();
     Assert.IsTrue(game.IsActive, "IsActive should be true");
 }
Пример #46
0
 public static void Main()
 {
     {
         var test = new TestController();
         test.TestExitLoop();
         test.TestPlayState();
         test.TestStop();
         test.TestPause();
         test.TestDefaultValues();
         test.TestVolume();
         test.TestIsLooped();
         test.TestPlay();
     }
     {
         var test = new TestAudioSystem();
         test.TestDopplerCoherency();
         test.TestAttenuationCoherency();
         test.TestLocalizationCoherency();
         test.TestSeveralControllers();
         test.TestEffectsAndMusic();
         test.TestAddRemoveEmitter();
         test.TestRemoveListener();
         test.TestAddListener();
         test.TestAudioEngine();
         test.TestAddRemoveListener();
     }
     {
         var test = new TestAudioEmitterProcessor();
         test.TestEmitterUpdateValues();
         test.TestAddRemoveListeners();
         test.TestAddRemoveEntityWithEmitter();
         test.TestAddRemoveSoundEffect();
     }
     {
         var test = new TestAudioEmitterComponent();
         test.TestInitialization();
         test.TestAttachDetachSounds();
         test.TestGetController();
     }
     {
         var test = new TestAudioListenerProcessor();
         test.TestAddAudioSysThenEntitySys();
         test.TestAddEntitySysThenAudioSys();
         test.TestRemoveListenerFromAudioSystem();
         test.TestRemoveListenerFromEntitySystem();
     }
     {
         var test = new TestGame();
         test.TestAccessToAudio();
         test.TestCreationDestructionOfTheGame();
     }
     {
         var test = new TestScriptContext();
         test.TestScriptCreationDestruction();
         test.TestScriptAudioAccess();
     }
     {
         var test = new TestAssetLoading();
         test.TestSoundEffectLoading();
         test.TestSoundMusicLoading();
     }
 }
 public void ProcessInput(TestGame testGameInstance, GameTime gameTime)
 {
     GetCurrentInputController().ProcessInput(testGameInstance, gameTime);
 }
Пример #48
0
        public void UpdateNotCalledOnDisabledIUpdatableGameComponent()
        {
            TestGame game = new TestGame(new NullEventSource());

            GameComponentTestBase gc = new GameComponentTestBase(game);
            game.Components.Add(gc);
            gc.Enabled = false;

            game.Run();

            Assert.AreEqual(0, gc.CountUpdate);
        }
	public float[][] brainOutput;  // !! Or if this should live inside the miniGameInstance

	public TestGameManager(TestTrainer testTrainer) {
		testTrainerRef = testTrainer;
		testGameInstance = new TestGame();
		SetInputOutputArrays();
	}
Пример #50
0
 static void Main()
 {
     using (var game = new TestGame())
         game.Run();
 }
Пример #51
0
 public ParticleLight(TestGame game, int width, int height)
     : base(game, width, height)
 {
 }
Пример #52
0
        public void InitializeCalledOnIGameComponentTest()
        {
            TestGame game = new TestGame(new NullEventSource());

            GameComponentTestBase gc = new GameComponentTestBase(game);
            game.Components.Add(gc);

            game.Run();

            Assert.AreEqual(1, gc.CountInitialize);
        }
Пример #53
0
 public RampTest(TestGame game, int width, int height)
     : base(game, width, height)
 {
 }
Пример #54
0
        public void GameSleepsWhenDeactivatedTest()
        {
            DelegateBasedEventSource evt = new DelegateBasedEventSource(delegate(DelegateBasedEventSource e)
                                                                            {
                                                                                ((TestGameWindow)e.Game.Window).RaiseDeactivating();
                                                                                Assert.IsFalse(e.Game.IsActive, "Game should be inactive.");
                                                                                e.Game.Tick();
                                                                            });
            TestGame gd = new TestGame(evt, true);
            gd.InactiveSleepTime = TimeSpan.FromMilliseconds(500);

            Stopwatch sw = Stopwatch.StartNew();
            gd.Run();
            sw.Stop();
            Assert.IsTrue(sw.ElapsedMilliseconds >= 500, "Time elapsed should be at least 500ms");
        }
Пример #55
0
 public LightingTest(TestGame game, int width, int height)
     : base(game, width, height)
 {
 }
Пример #56
0
 protected Entity(TestGame game) : base(game)
 {
 }
Пример #57
0
 public void IsFixedTimeStepDefaultTrueTest()
 {
     TestGame game = new TestGame();
     Assert.IsTrue(game.IsFixedTimeStep, "IsFixedTimeStep should be true");
 }
 protected override Game CreateGame() => game = new TestGame();
Пример #59
0
        internal void Update(TestGame update)
        {
            string sql = @"UPDATE testgame SET playerName = @PlayerName, profileImg = @ProfileImg, playerEnergy = @PlayerEnergy, playerTool = @PlayerTool, playerMoney = @PlayerMoney, resource1 = @Resource1, resource2 = @Resource2, resource3 = @Resource3, resource4 = @Resource4, planetId = @PlanetId WHERE id = @Id;";

            _db.Execute(sql, update);
        }