Exemplo n.º 1
0
        protected override void Initialize()
        {
            base.Initialize();

            IsMouseVisible = true;
            Window.Title   = "Cartel Game";

            graphics.PreferredBackBufferWidth  = GraphicsDevice.DisplayMode.Width;
            graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
            //graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            var control = System.Windows.Forms.Control.FromHandle(Window.Handle);
            var form    = control.FindForm();

            form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            form.WindowState     = System.Windows.Forms.FormWindowState.Maximized;

            world      = new World(100, 100);
            jobManager = new JobManager(world);
            world.SetJobManager(jobManager);
            viewportManager = new ViewportManager(GraphicsDevice.Viewport, world);
            worldRenderer   = new WorldRenderer(world, viewportManager, GraphicsDevice);
            guiManager      = new GUIManager(world, viewportManager, GraphicsDevice);
            fpsManager      = new FPSManager();

            guiManager.AddTask("Build Walls", InputTask.BlueprintFactory(InputMode.Line, cell => new Wall(cell)));
            guiManager.AddTask("Build Floors", InputTask.BlueprintFactory(InputMode.Area, cell => new Floor(cell, FloorType.Concrete)));
            guiManager.AddTask("Build Light", InputTask.BlueprintFactory(InputMode.Single, cell => new Light(cell)));
            guiManager.AddTask("Spawn Worker", InputTask.PawnFactory(PawnType.Worker));
            guiManager.AddTask("Spawn Gardener", InputTask.PawnFactory(PawnType.Gardener));
            guiManager.AddTask("Add Concrete", InputTask.SoftObjectFactory(SoftObjectType.Concrete, 45));
            guiManager.AddTask("Create GrowZone", InputTask.ZoneFactory(() => {
                return(new GrowZone(PlantType.Indica));
            }));
            ObjectInfo benchInfo = new ObjectInfo(ObjectType.Bench, new Point(2, 1));

            guiManager.AddTask("Create HardObject", InputTask.BlueprintFactory(InputMode.Single, cell => new HardObject(benchInfo, cell)));
            guiManager.AddTask("Bulldoze", InputTask.BulldozeFactory());
        }