Пример #1
0
        public GameScreen(ContentManager content, GraphicsDeviceManager graphics, Camera camera, InputManager input)
        {
            GameState.Current    = new GameState(camera, GridSize, content);
            mGroundPlaneRenderer = new PlaneRenderer(graphics, camera, new BasicEffect(graphics.GraphicsDevice)
            {
                TextureEnabled = true,
                Texture        = content.Load <Texture2D>("textures/ground_sand")
            });
            mHeroEffect = content.Load <Effect>("effects/HeroEffect").Clone();
            mHeroEffectPlaneRenderer   = new PlaneRenderer(graphics, camera, mHeroEffect);
            LoadAndSaveManager.Current = new LoadAndSaveManager(GridSize, camera, this, content);
            mWhitePixel = new Texture2D(graphics.GraphicsDevice, 1, 1);
            mWhitePixel.SetData(new[] { Color.White });
            mGraphics    = graphics;
            mCamera      = camera;
            mInput       = input;
            BuildManager = new BuildManager(input);
            BuildManagerWrapper.Init(BuildManager);
            BuildManagerWrapper.LoadInputManager(input);
            GameStateWrapper.LoadInputManager(input);
            input.SetSelectAction(SelectUnits);
            mFontMenu  = content.Load <SpriteFont>("fonts/Menu");
            mFontSmall = content.Load <SpriteFont>("fonts/Small");

            LoadAndSaveManager.Current.LoadMap("map01", true);
            mStatusBarRenderer = new StatusBarRenderer(graphics.GraphicsDevice, content, camera);
            camera.Position    = new Vector3(GridSize / -2f, GridSize * GridSize, 4 * GridSize);
            GameStateWrapper.StartGame();
        }