コード例 #1
0
        static void ConsoleAsteroidsTest()
        {
            Game game = new AsteroidsGame(new ConsoleDrawer(10, 10));

            game.Start();
            while (!game.IsOver)
            {
                game.Update();
            }
        }
コード例 #2
0
        static void SFMLAsteroidsTest()
        {
            Game game = new AsteroidsGame(new SFMLDrawer(10, 10));

            game.Start();
            while (!game.IsOver)
            {
                game.Update();
            }
        }
コード例 #3
0
        static void AsteroidsArenaTest()
        {
            Game game = new AsteroidsGame(new ConsoleDrawer(10, 10));

            // var ship = game.CreateOnScene<Ship>(new Vector2(4, 0));
            game.Start();
            game.Update();

            var ship = game.GetFromScene <Ship>()[0];

            ship.Transform.Transform.Position = new Vector2(4, 0);
            ship.Transform.Direction          = new Vector2(1, 0);
            ship.Velocity = new Vector2(1, 0);

            game.Update();
            System.Console.WriteLine(ship.Transform.Position == new Vector2(5, 0));
            game.Update();
            System.Console.WriteLine(ship.Transform.Position == new Vector2(-4, 0));
            game.Update();
            game.Update();
            game.Update();
            System.Console.WriteLine(ship.Transform.Position == new Vector2(-1, 0));
            // System.Console.WriteLine(game.Score == 0);
        }