コード例 #1
0
        private static void InitializeGameMap(Engine engine)
        {
            // Vertical walls
            for (int i = 1; i <= 30; i++)
            {
                Wall leftWall = new Wall(new Position(i, 1));
                Wall rightWall = new Wall(new Position(i, 40));
                engine.AddObject(leftWall);
                engine.AddObject(rightWall);
            }

            // Horizontal walls (ROW 1 and ROW 30)
            for (int i = 2; i <= 40; i++)
            {
                Wall topWall = new Wall(new Position(1, i));
                Wall bottomWall = new Wall(new Position(30, i));
                engine.AddObject(topWall);
                engine.AddObject(bottomWall);
            }

            // Internal blocks
            foreach (var block in Map.GetMap())
            {
                engine.AddObject(block);
            }
        }
コード例 #2
0
        private static void InitializeGamePlayersAndResults(Engine engine)
        {
            Console.Title = "UnstoppableMickey © Team Mickey Mouse";

            // Controlled object
            engine.AddObject(Factory.CreateObject(Factory.ObjectType.Mickey, new Position(16, 15)));

            // Initial moving objects
            engine.AddObject(Factory.CreateObject(Factory.ObjectType.Cat, new Position(2, 2), Position.RandomDirection()));
            engine.AddObject(Factory.CreateObject(Factory.ObjectType.Cat, new Position(2, 39), Position.RandomDirection()));
            engine.AddObject(Factory.CreateObject(Factory.ObjectType.Cat, new Position(29, 2), Position.RandomDirection()));
            engine.AddObject(Factory.CreateObject(Factory.ObjectType.Cat, new Position(29, 39), Position.RandomDirection()));

            // Result objects
            CatsNumber catsNumber = new CatsNumber(new Position(31, 32), "Cats", ConsoleColor.Yellow);
            Points points = new Points(new Position(31, 1), "Points", ConsoleColor.Green);
            engine.AddObject(catsNumber);
            engine.AddObject(points);
        }