Beispiel #1
0
        //private SoundManager sound;

        public SimpleGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            graphics.PreferredBackBufferWidth  = width;
            graphics.PreferredBackBufferHeight = height;

            input = new InputHandler(this);
            Components.Add(input);

            background         = new Background(this, @"Textures\");
            background.Enabled = background.Visible = false;
            Components.Add(background);

            cam = new CelAnimationManager(this, @"Textures\");
            Components.Add(cam);

            player          = new Player(this);
            player.Position = playerPosition;
            Components.Add(player);

            enemies = new EnemyManager(this);
            Components.Add(enemies);

            fade = new FadeOut(this);
            Components.Add(fade);

            explosionManager = new ExplosionManager(this);
            Components.Add(explosionManager);

            //sound = new SoundManager(this, "Chapter7");
            //Components.Add(sound);
        }
Beispiel #2
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth  = 1000;
            graphics.PreferredBackBufferHeight = 600;

            Content.RootDirectory = "Content";

            inputHandler = new InputHandler(this);
            Components.Add(inputHandler);

            celAnimationManager = new CelAnimationManager(this, "Player\\");

            Components.Add(celAnimationManager);

            player  = new Player(this);
            enemies = new List <Enemy>();
            Random random = new Random();

            for (int i = 0; i < EnemiesNumber; i++)
            {
                enemies.Add(new Enemy(this, new Vector2(random.Next(100, 900), random.Next(100, 500)), i, ref player));
            }
            foreach (var item in enemies)
            {
                Components.Add(item);
            }
            Components.Add(player);
        }
Beispiel #3
0
        //Into Screen

        #endregion

        public Game1()
            : base()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            //Game Services
            input               = new InputHandler(this);
            console             = new GameConsole(this);
            celAnimationManager = new CelAnimationManager(this);
            this.Components.Add(input);
            this.Components.Add(console);
            this.Components.Add(celAnimationManager);



            #region GameStates
            gameManager     = new GameStateManager(this);
            TitleIntroState = new TitleIntroState(this);
            StartMenuState  = new StartMenuState(this);
            PlayingState    = new PlayingState(this);
            PausedState     = new PausedState(this);

            gameManager.ChangeState(TitleIntroState.Value);
            #endregion
        }
Beispiel #4
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);

            graphics.PreferredBackBufferWidth = 1366;
            graphics.PreferredBackBufferHeight = 768;

            Content.RootDirectory = "Content";

            sb = new SpriteBatch(GraphicsDevice);

            input = new InputHandler(this);

            this.Components.Add(input);

            celAnimationManager = new CelAnimationManager(this);
            this.Components.Add(celAnimationManager);

            GameManager = new GameStateManager(this);

            PlayingState = new PlayingState(this);
            PausedState = new PausedState(this);
            TitleState = new TitleIntroState(this);
            StartMenuState = new StartMenuState(this);
            EndState = new EndState(this);

            GameManager.ChangeState(TitleState.Value);
            //GameManager.ChangeState(PlayingState.Value);
        }
Beispiel #5
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            cam = new CelAnimationManager(this, @"Textures\");
            Components.Add(cam);
        }
Beispiel #6
0
        public EnemyManager(Game game)
            : base(game)
        {
            // TODO: Construct any child components here
            rand = new Random();

            cam = (CelAnimationManager)game.Services.GetService(
                typeof(ICelAnimationManager));
        }
Beispiel #7
0
 public Player(Game game)
     : base(game)
 {
     input = (InputHandler)game.Services.GetService(
         typeof(IInputHandler));
     cam = (CelAnimationManager)game.Services.GetService(
         typeof(ICelAnimationManager));
     Visible = Enabled = false;
 }
        public SpriteAnimationAdapter(Game game)
        {
            spriteAnimations = new List <SpriteAnimation>();

            celAnimationManger = (CelAnimationManager)game.Services.GetService(typeof(ICelAnimationManager));
            if (celAnimationManger == null)
            {
                throw new Exception("To use a DrawableAnimatedSprite you must a CelAnimationManager to the game as a service!");
            }
        }
Beispiel #9
0
        public ExplosionManager(Game game, int maxExplosions) : base(game)
        {
            simpleGame = (SimpleGame)game;

            cam = (CelAnimationManager)game.Services.GetService(
                typeof(ICelAnimationManager));
            if (maxExplosions > 0)
            {
                SetMaxNumberOfExplosions(maxExplosions);
            }
        }
Beispiel #10
0
        public SimpleGame()
        {
            graphics = new GraphicsDeviceManager(this);
//#if !ZUNE
            Content.RootDirectory = "Content";
//#else
//            Content.RootDirectory = "ZuneContent";
//#endif

            graphics.PreferredBackBufferWidth  = width;
            graphics.PreferredBackBufferHeight = height;

            graphics.ApplyChanges();

#if ZUNE
            zuneRenderTarget = new RenderTarget2D(
                GraphicsDevice,
                width,
                height,
                0,
                SurfaceFormat.Color);
#endif

            input = new InputHandler(this);
            Components.Add(input);

            background         = new Background(this, @"Textures\");
            background.Enabled = background.Visible = false;
            Components.Add(background);

            cam = new CelAnimationManager(this, @"Textures\");
            Components.Add(cam);

            player          = new Player(this);
            player.Position = playerPosition;
            Components.Add(player);

            enemies = new EnemyManager(this);
            Components.Add(enemies);

            explosionManager = new ExplosionManager(this);
            Components.Add(explosionManager);

            fade = new FadeOut(this);
            Components.Add(fade);

            fps = new FPS(this);
            Components.Add(fps);

            sound = new SoundManager();

            //backgroundThread = new Thread(BackgroundMusicThread);
        }
        public SpriteAnimationAdapter(Game game, Sprite sprite)
        {
            this.parent      = sprite;
            spriteAnimations = new List <SpriteAnimation>();

            celAnimationManger = (CelAnimationManager)game.Services.GetService(typeof(ICelAnimationManager));
            if (celAnimationManger == null)
            {
                //throw new Exception("To use a DrawableAnimatedSprite you must a CelAnimationManager to the game as a service!");
                celAnimationManger = new CelAnimationManager(game);
                game.Components.Add(celAnimationManger);
            }
        }
Beispiel #12
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            fps                 = new FPS(this);
            input               = new InputHandler(this);
            gameConsole         = new GameConsole(this);
            celAnimationManager = new CelAnimationManager(this);
            this.Components.Add(fps);
            this.Components.Add(input);
            this.Components.Add(gameConsole);
            this.Components.Add(celAnimationManager);
        }
Beispiel #13
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);


            Content.RootDirectory = "Content";
            IsMouseVisible        = true;

            //full screen.
            graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            graphics.PreferredBackBufferWidth  = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;

            //windowed screen.

            //graphics.PreferredBackBufferHeight = 1000;
            //graphics.PreferredBackBufferWidth = 1600;

            screen_height = graphics.PreferredBackBufferHeight;
            screen_width  = graphics.PreferredBackBufferWidth;

            FontScale = Game1.screen_height * 0.00055f; // for scaling our fonts to different screens.

            inputHandler = new InputHandler(this);
            Components.Add(inputHandler);

            celAnimationManager = new CelAnimationManager(this, "Textures\\Animations");
            Components.Add(celAnimationManager);

            soundManager = new SoundManager(this);
            Components.Add(soundManager);

            stateManager = new GameStateManager(this);
            Components.Add(stateManager);



            TitleIntroState      = new TitleIntroState(this);
            StartMenuState       = new StartMenuState(this);
            ChooseFlagState      = new ChooseFlagState(this);
            PausedState          = new PausedState(this);
            OptionsMenuState     = new OptionsMenuState(this);
            BuildingBoardState   = new BuildingBoardState(this);
            PlacingSoldiersState = new PlacingSoldiersState(this);
            PlayingState         = new PlayingState(this);

            EnableSoundFx = true;
            EnableMusic   = true;
        }
Beispiel #14
0
        public Game1()
        {
            random   = new Random();
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth  = 1000;
            graphics.PreferredBackBufferHeight = 600;


            scrollingBackgroundManager = new ScrollingBackgroundManager(this, "Textures\\");
            Components.Add(scrollingBackgroundManager);



            ScreenWidth  = graphics.PreferredBackBufferWidth;
            ScreenHeight = graphics.PreferredBackBufferHeight;

            Content.RootDirectory = "Content";

            inputHandler = new InputHandler(this);
            Components.Add(inputHandler);

            celAnimationManager = new CelAnimationManager(this, "Textures\\");
            Components.Add(celAnimationManager);



            player            = new Player(this);
            ghost_for_cloning = new Ghost(this, player, random);
            sprites           = new List <Sprite>()
            {
                new Ghost(this, player, random),
                new Ghost(this, player, random),
                new Ghost(this, player, random),
                new Ghost(this, player, random),
                ghost_for_cloning,
                player
            };

            foreach (Sprite sprite in sprites)
            {
                Components.Add(sprite);
            }

            Components.Remove(ghost_for_cloning);//we dont want to draw this ghost
        }
Beispiel #15
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);

            Content.RootDirectory = "Content";
            this.IsMouseVisible   = true;

            graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            graphics.PreferredBackBufferWidth  = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;

            screen_height = graphics.PreferredBackBufferHeight;
            screen_width  = graphics.PreferredBackBufferWidth;

            inputHandler = new InputHandler(this);
            Components.Add(inputHandler);

            celAnimationManager = new CelAnimationManager(this, "Textures\\Animations");
            Components.Add(celAnimationManager);

            soundManager = new SoundManager(this);
            Components.Add(soundManager);

            stateManager = new GameStateManager(this);
            Components.Add(stateManager);

            TitleIntroState = new TitleIntroState(this);
            StartMenuState  = new StartMenuState(this);

            PausedState          = new PausedState(this);
            OptionsMenuState     = new OptionsMenuState(this);
            BuildingBoardState   = new BuildingBoardState(this);
            PlacingSoldiersState = new PlacingSoldiersState(this);
            PlayingState         = new PlayingState(this);

            EnableSoundFx = true;
            EnableMusic   = true;
        }
Beispiel #16
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            //Game Services
            fps                 = new FPS(this);
            input               = new InputHandler(this);
            console             = new GameConsole(this);
            celAnimationManager = new CelAnimationManager(this);
            this.Components.Add(fps);
            this.Components.Add(input);
            this.Components.Add(console);
            this.Components.Add(celAnimationManager);

            pacMan = new PacManAnimated(this);
            gm     = new GhostManager(this);

            food1 = new Food(this);
            food2 = new Food(this);
            food3 = new Food(this);
            food4 = new Food(this);

            foods = new List <Food>();
            foods.Add(food1);
            foods.Add(food2);
            foods.Add(food3);
            foods.Add(food4);

            foreach (Food f in foods)
            {
                this.Components.Add(f);
            }

            this.Components.Add(pacMan);
            this.Components.Add(gm);
        }