Exemplo n.º 1
0
        /// <summary>
        /// Entry-point into the application
        ///
        /// bootstraps some basic settings and sets up some platform specific features aka
        /// fixes windows!
        /// </summary>
        /// <param name="args"></param>
        private static void Main(string[] args)
        {
            // change some windows specific options to enable ansi escape sequences
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                WindowsSetup.SetupConsole();
            }

            // disable the cursor visibility
            Console.CursorVisible  = false;
            Console.OutputEncoding = Encoding.Default;

            // set the window and the buffer size to be the same to disable the scrollbar
            Console.SetWindowSize(ApplicationWidth, ApplicationHeight);
            Console.SetBufferSize(ApplicationWidth, ApplicationHeight);

            // create directory if it doesn't exist
            if (!Directory.Exists("mazes"))
            {
                Directory.CreateDirectory("mazes");
            }

            // start the actual game
            var mazeGame = new MazeGame();

            mazeGame.Start();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            MazeGame    mazeGame = new MazeGame();
            MazeFactory factory  = new EnchantedMazeFactory();

            Maze maze = mazeGame.CreateMaze(factory);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            // Ordinary maze, not particularly interesting.
            MazeFactory factory = new MazeFactory();

            MazeGame.CreateMaze(factory);

            MazeFactory enchangedMazeFactory = new EnchangedMazeFactory();
            var         enchantedMaze        = MazeGame.CreateMaze(enchangedMazeFactory);

            if (enchantedMaze.RoomNo(1) is EnchantedRoom)
            {
                Console.WriteLine("The second maze is enchanted, factory did its work.");
            }
            else
            {
                Console.WriteLine("Something wrong with the Absctract factory, the maze is still ordinary.");
            }

            var oneMoreEnchantedMaze = new EnchantedMazeGame().CreateMaze();

            if (oneMoreEnchantedMaze.RoomNo(1) is EnchantedRoom)
            {
                Console.WriteLine("The third maze is enchanted, overriden factory methods did their work.");
            }
            else
            {
                Console.WriteLine("Something wrong with the factory methods, the maze is still ordinary.");
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            MazeGame mazeGame = new MazeGame();
            MazeFactory factory = new EnchantedMazeFactory();

            Maze maze = mazeGame.CreateMaze(factory);
        }
Exemplo n.º 5
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (MazeGame game = new MazeGame())
     {
         game.Run();
     }
 }
Exemplo n.º 6
0
		public MazeController(MazeGame game, MazeView view)
		{
			_game = game;
			_view = view;
			_monsterTimer.Tick += new System.EventHandler(this.monsterTimer_Tick);
			_monsterTimer.Interval = 200;
			//_monsterTimer.Start();
		}
Exemplo n.º 7
0
		public MazeView (MazeGame game, MainForm form)
		{
			_context = new DrawContext(null);
			_game = game;
			_game.View = this;
			_form = form;
			_control = _form.pnlMazeView;
		}
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            // normal game
            MazeGame mazeGame = new MazeGame();
            Maze maze = mazeGame.CreateMaze();

            // another type of game
            EnchantedMazeGame enchantedMazeGame = new EnchantedMazeGame();
            Maze enchantedMaze = enchantedMazeGame.CreateMaze();
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            // normal game
            MazeGame mazeGame = new MazeGame();
            Maze     maze     = mazeGame.CreateMaze();

            // another type of game
            EnchantedMazeGame enchantedMazeGame = new EnchantedMazeGame();
            Maze enchantedMaze = enchantedMazeGame.CreateMaze();
        }
Exemplo n.º 10
0
 /// <summary>
 /// Enemy constructor that position enemy in the maze and assign loaded content such
 /// as model asset and audio.
 /// </summary>
 /// <param name="game">The maze game</param>
 /// <param name="device">grapfics device</param>
 /// <param name="model">model for enemy</param>
 /// <param name="position">initial position of enemy</param>
 /// <param name="leftFootStepAudio">left foot step sound for enemy</param>
 /// <param name="rightFootStepAudio">right foot step sound for enemy</param>
 public Enemy(MazeGame game, GraphicsDevice device, Model model, Vector3 position, 
     SoundEffect leftFootStepAudio, SoundEffect rightFootStepAudio)
 {
     this.game = game;
     this.device = device;
     this.model = model;
     this.position = position;
     this.leftFootStepAudio = leftFootStepAudio;
     this.rightFootStepAudio = rightFootStepAudio;
     boneTransforms = new Matrix[model.Bones.Count];
     leftLegTransform = model.Bones["left_leg"].Transform;
     rightLegTransform = model.Bones["right_leg"].Transform;
 }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            //--------------------------------------------------- Prototype
            MazeGame game = new MazeGame();

            MazePrototypeFactory simpleMazeFactory = new MazePrototypeFactory(new Maze(), new Wall(), new Room(1), new Door());

            //Maze maze = game.CreateMaze(simpleMazeFactory);
            Maze maze = game.CreateMaze();

            MazePrototypeFactory bombedMazeFactory = new MazePrototypeFactory(new Maze(), new Wall(), new Room(1), new Door());

            Console.ReadKey();
        }
Exemplo n.º 12
0
 static void Main()
 {
     using (var game = new MazeGame()) game.Run();
 }
Exemplo n.º 13
0
 static void Main(string[] args)
 {
     MazeGame mazeGame = new MazeGame();
     Maze     maze     = mazeGame.CreateMaze();
 }
Exemplo n.º 14
0
 static void Main(string[] args)
 {
     MazeGame mazeGame = new MazeGame();
     Maze maze = mazeGame.CreateMaze();
 }
Exemplo n.º 15
0
		private void MainForm_Load(object sender, System.EventArgs e)
		{
			//control initialization to enable proper resizing
			lnkQuitOffset = panel1.Width - lnkQuit.Left;
			lnkNewGameOffset = panel1.Width - lnkNewGame.Left;
			cmbDifficultyOffset = panel1.Width - cmbDifficulty.Left;
			MazeViewOffset = new Size(Width - pnlMazeView.Width, Height - pnlMazeView.Height);

			//MVC initialization
			game = new MazeGame();
			view = new MazeView(game,this);
			controller = new MazeController(game,view);
			controller.Difficulty = difficulty.Easy;
			//controller.CreateMaze();
			this.cmbDifficulty.SelectedIndex = (int)controller.Difficulty;
		}