Ejemplo n.º 1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            gameServices = new GameServices(this);

            contentManager = new PlayContentManager(Services, Content.RootDirectory);
            gameServices.AddService <IContentService>(contentManager);

            sceneManager = new SceneManager();
            gameServices.AddService <ISceneService>(sceneManager);

            randomManager = new RandomManager();
            gameServices.AddService <IRandomService>(randomManager);

            base.Initialize();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>

        protected override void Initialize()
        {
            asteroidList        = new List <IEntity>();
            enemyList           = new List <IEntity>();
            score               = 0;
            body                = new Ball[8];
            midOffSetx          = 30;
            midOffSety          = -5;
            dbOffSetx           = 25;
            dbOffSety           = 10;
            enemy01Time         = 0;
            enemy01Limit        = 200;
            asteroidTimeLimit   = 100;
            asteroidTime        = 0;
            fontColor           = ColorConverter("#00FF99");
            gameState           = GameState.Start;
            this.IsMouseVisible = true;
            // TODO: Add your initialization logic here
            GameServices.AddService <GraphicsDevice>(graphics.GraphicsDevice);
            player          = new Player(this.Content);
            player.gameOver = false;
            for (int i = 0; i < 8; i++)
            {
                body[i] = ball = new Ball(this.Content);
            }
            player.Initialize();
            player.asteroidList = asteroidList;
            player.enemyList    = enemyList;
            base.Initialize();
            //GameServices.AddService<ContentManager>(Content);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            onMouseLeftButtonClick += OnMouseLeftButtonClick;

            onMouseLeftButtonPressed   += OnMouseLeftButtonPressed;
            onMouseLeftButtonReleased  += OnMouseLeftButtonReleased;
            onMouseRightButtonClick    += OnMouseRightButtonClick;
            onMouseRightButtonPressed  += OnMouseRightButtonPressed;
            onMouseRightButtonReleased += OnMouseRightButtonReleased;
            onMouseMove += OnMouseMove;
            OnCtrlPlusZ += OnCtrlZ;
            OnCtrlPlusY += OnCtrlY;

            leftButtonPressed = false;

            GameServices.AddService <GraphicsDevice>(GraphicsDevice);
            GameServices.AddService <ContentManager>(Content);

            map = new Map();

            GenerateTileBounds();

            ledgePaletteLocation = new List <Vector2>();

            for (int i = 0; i < 16; i++)
            {
                var y = 50 + i * 20;
                ledgePaletteLocation.Add(new Vector2(paletteOffsetX, y));
            }

            base.Initialize();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            T = new Texture2D(GraphicsDevice, 1, 1);
            T.SetData(new [] { Color.White });

            //Screen stuff
            graphics.PreferredBackBufferWidth  = GeneralSettings.screenWidth;
            graphics.PreferredBackBufferHeight = GeneralSettings.screenHeight;
            graphics.ApplyChanges();

            GameServices.AddService(graphics);
            GameServices.AddService(GraphicsDevice);
            GameServices.AddService(Content);

            players.Add(new Player("Player 1", new Vector2(300, 300), Content.Load <Texture2D>("Textures/player")));
            players.Add(new Player("Player 2", new Vector2(400, 400), Content.Load <Texture2D>("Textures/player")));

            GameServices.AddService(players);

            LevelController = new LevelController();
            LevelController.GoToNextLevel();
            GameServices.AddService(LevelController);

            MenuController = new MenuController();
            ShopCost       = 50;

            base.Initialize();
        }
Ejemplo n.º 5
0
 protected void InitServiceCollection()
 {
     GameServices.SetGameServiceContainer(Services);
     GameServices.AddService(SpriteBatch);
     GameServices.AddService(Window);
     GameServices.AddService(Graphics);
 }
Ejemplo n.º 6
0
        public ColorCollisionsGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            GameServices.AddService(graphics);
            GameServices.AddService(Content);
        }
Ejemplo n.º 7
0
        public DriveFastGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            GameServices.AddService(graphics);
            GameServices.AddService(Content);
        }
Ejemplo n.º 8
0
        public override void LoadContent(SpriteBatch spriteBatch)
        {
            base.LoadContent(spriteBatch);
            var font = ContentManager.Load <BitmapFont>(@"Font\Default");

            _guiDesigner = new GuiDesigner(GraphicsDeviceManager.GraphicsDevice, font);
            GameServices.AddService(_guiDesigner);
            InitializeCommandManager();
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     Content.RootDirectory = "GameJamTestContent";
     MediaPlayer.Volume    = 0.5f;
     //MediaPlayer.Volume = 0;
     base.Initialize();
     GameServices.AddService <GraphicsDevice>(GraphicsDevice);
     GameServices.AddService <ContentManager>(Content);
     keyboard = new GameKeyboard();
 }
Ejemplo n.º 10
0
        public WizardGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            GameServices.AddService(graphics);
            GameServices.AddService(Content);

            wizard = new Wizard();
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     GameServices.AddService <GraphicsDevice>(GraphicsDevice);
     GameServices.AddService <ContentManager>(Content);
     //CreateDefaultTileset();
     //CreateTestMap();
     screenManagerComponent.AddScreen <WorldScreen>(true);
     screenManagerComponent.AddScreen <MapEditorScreen>();
     base.Initialize();
 }
Ejemplo n.º 12
0
 protected override void Initialize()
 {
     CalcButtonSize();
     base.Initialize();
     GameServices.AddService <GraphicsDevice>(GraphicsDevice);
     GameServices.AddService <GraphicsDeviceManager>(graphics);
     GameServices.AddService <Resolution>(resolution);
     resolution.SetFullscreen(true);
     GameServices.AddService <ContentLoader>(new ContentLoader(this));
     GameServices.AddService <ShroomGame>(this);
 }
Ejemplo n.º 13
0
        protected override void LoadContent()
        {
            base.LoadContent();

            spriteBatch = new SpriteBatch(GraphicsDevice);

            EmbeddedContent  = new XNBContentManager(GraphicsDevice);
            GraphicUtilities = new GraphicUtilities();

            Content.RootDirectory = "Content";
            GameServices.AddService <ContentManager> (Content);
        }
Ejemplo n.º 14
0
        public SpaceMAS()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            //IsFixedTimeStep = true;
            //TargetElapsedTime = TimeSpan.FromMilliseconds(1000 / 600);
            //graphics.SynchronizeWithVerticalRetrace = false;
            //graphics.ApplyChanges();

            GameServices.AddService(this);
        }
Ejemplo n.º 15
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            GameServices.AddService(spriteBatch);

            TrackOverlayTexture = Content.Load <Texture2D>("TrackOverlay");
            car.LoadContent();

            trackRender = new RenderTarget2D(graphics.GraphicsDevice, car.Size.Width + 100,
                                             car.Size.Height + 100);
            trackRenderRotated = new RenderTarget2D(graphics.GraphicsDevice, car.Size.Width + 100,
                                                    car.Size.Height + 100);
        }
Ejemplo n.º 16
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(graphics.GraphicsDevice);

            GameServices.AddService <GraphicsDevice>(graphics.GraphicsDevice);
            GameServices.AddService <SpriteBatch>(spriteBatch);
            GameServices.AddService <ContentManager>(Content);

            SpriteSturcture spriteSturcture = new SpriteSturcture("player", "Player", 2, 3);
            MotionStructure motionStructure = new MotionStructure(Center, 300f);
            DrawStructure   drawStructure   = new DrawStructure(Vector2.One, 0f, Color.White, SpriteEffects.None, 1.0f);
            Animation       animation       = new Animation("Flash", new List <int> {
                1, 2, 3, 4, 5, 6
            }, 10);
            AnimationStructure animationStructure = new AnimationStructure(animation);

            GameObject gameObject = new GameObject(spriteSturcture, motionStructure, drawStructure, animationStructure);

            GameContent.AddObject(gameObject);
        }
Ejemplo n.º 17
0
 public EntitySystem(Game game)
 {
     Game = game;
     GameServices.AddService(this);
 }
Ejemplo n.º 18
0
        protected override void LoadContent()
        {
            Resources.Init(Content);
            // MUSIC INIT
            MusicGameObject = new GameObject("MusicManagerContainer");
            MusicGameObject.AddComponent(new MusicManager());
            //
            spriteBatch        = new SpriteBatch(GraphicsDevice);
            shadowRenderTarget = new RenderTarget2D(graphics.GraphicsDevice, shadowMapWidthHeight, shadowMapWidthHeight,
                                                    false, SurfaceFormat.Single, DepthFormat.Depth24);
            screenRenderTarget = new RenderTarget2D(graphics.GraphicsDevice, graphics.GraphicsDevice.Viewport.Width,
                                                    graphics.GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24);
            refractionTarget = new RenderTargetCube(this.GraphicsDevice, shadowMapWidthHeight, true, SurfaceFormat.Color, DepthFormat.Depth24);

            outlineEffect = Content.Load <Effect>("Outline");
            outlineEffect.Parameters["ScreenSize"].SetValue(
                new Vector2(GraphicsDevice.Viewport.Bounds.Width, GraphicsDevice.Viewport.Bounds.Height));
            dialoguesFont = Content.Load <SpriteFont>("Dialogues");

            menuTexture    = Content.Load <Texture2D>("Menus/menuTlo");
            optionsTexture = Content.Load <Texture2D>("Menus/opcjeTlo");
            creditsTexture = Content.Load <Texture2D>("Menus/autorzy");
            deadTexture    = Content.Load <Texture2D>("Menus/youDied");

            deadButtonTexture[RestartButtonIndex]  = Content.Load <Texture2D>("Menus/restart");
            deadButtonTexture[ExitDeadButtonindex] = Content.Load <Texture2D>("Menus/menuExit");

            menuButtonTexture[StartButtonIndex]   = Content.Load <Texture2D>("Menus/menuStart");
            menuButtonTexture[OptionsButtonIndex] = Content.Load <Texture2D>("Menus/menuOptions");
            menuButtonTexture[CreditsButtonIndex] = Content.Load <Texture2D>("Menus/menuCredits");
            menuButtonTexture[ExitButtonIndex]    = Content.Load <Texture2D>("Menus/menuExit");

            menuOptionButtonTexture[FullscreenButtonIndex]        = Content.Load <Texture2D>("Menus/full");
            menuOptionButtonTexture[BackButtonIndex]              = Content.Load <Texture2D>("Menus/inneBack");
            menuOptionButtonTexture[ExitOptionButtonIndex]        = Content.Load <Texture2D>("Menus/menuExit");
            menuOptionButtonTexture[BiggestResolutionButtonIndex] = Content.Load <Texture2D>("Menus/roz1");
            menuOptionButtonTexture[BigResolutionButtonIndex]     = Content.Load <Texture2D>("Menus/roz2");
            menuOptionButtonTexture[MediumResolutionButton]       = Content.Load <Texture2D>("Menus/roz3");
            menuOptionButtonTexture[SmallResolutionButton]        = Content.Load <Texture2D>("Menus/roz4");
            menuOptionButtonTexture[InvertAxisXButtonIndex]       = Content.Load <Texture2D>("Menus/aX");
            menuOptionButtonTexture[InvertAxisYButtonIndex]       = Content.Load <Texture2D>("Menus/aY");

            backButtonTexture = Content.Load <Texture2D>("Menus/inneBack");

            skybox = new Skybox("skybox/SkyBox", Content);

            hpTexture   = Content.Load <Texture2D>("hud/paskiZycie");
            timeTexture = Content.Load <Texture2D>("hud/paskiCzas");
            barsFront   = Content.Load <Texture2D>("hud/paskiPrzod");
            barsBack    = Content.Load <Texture2D>("hud/paskiTyl");
            icons       = new Texture2D[9];
            icons[0]    = Content.Load <Texture2D>("hud/ikonaStop");
            icons[1]    = Content.Load <Texture2D>("hud/ikonaCofnij");
            icons[2]    = Content.Load <Texture2D>("hud/ikonaTep");
            icons[3]    = Content.Load <Texture2D>("hud/ikonaStopSzara");
            icons[4]    = Content.Load <Texture2D>("hud/ikonaCofnijSzara");
            icons[5]    = Content.Load <Texture2D>("hud/ikonaTepSzara");

            bossBarFront  = Content.Load <Texture2D>("hud/pasekKrolaPrzod");
            bossBarBack   = Content.Load <Texture2D>("hud/pasekKrolaTyl");
            bossHpTexture = Content.Load <Texture2D>("hud/pasekKrolaZycie");

            actualDialogueText    = new string[3];
            actualDialogueText[0] = "";

            refractiveObject = new GameObject();
            root.AddChildNode(refractiveObject);

            player    = new GameObject("player");
            enemyList = new List <GameObject>();

            camera = new Camera();
            camera.SetCameraTarget(player);
            GameServices.AddService(camera);
            cameraCollision = new GameObject("cameraCollision");
            cameraCollision.AddComponent(new CameraCollisions(cameraCollision));

            pointLights      = new List <Lights.PointLight>();
            directionalLight = new Lights.DirectionalLight();
            missingTexture   = Content.Load <Texture2D>("Missing");
            updateComponents = new List <Component>();
        }