Пример #1
0
        public PlayingGameState()
        {
            DifficultySettings.SetDifficulty(DifficultyEnum.Easy);

            _crosshair = new Crosshair();

            _background = new Background();
            _fps        = new FontRender("fps counter");
            _fps.LoadContent("default");
            _fps.Location = new Vector2(40, Engine.ScaledViewPort.Y - 50);

            _score           = new ScoreBoard("score board");
            _hud             = new Hud("Hud");
            _levelController = new LevelController(new LevelBuilder().Levels);

            NextLevel();

            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER4, _hud);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER1, _background);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER4, _fps);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER4, _score);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER4, _billboard);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER5, _crosshair);

            Channels.AddNewChannel("score");
            Channels.AddNewChannel("duckhit");
            Channels.AddNewChannel("gunfired");

            _billboard.StartBillBoard("Level " + _levelController.LevelNumber);
        }
Пример #2
0
 public ScoreBoard(string name)
 {
     Name        = name;
     _scoreboard = new FontRender(name);
     _scoreboard.LoadContent("headsup");
     _scoreboard.Location = new Vector2(40, 40);
     _score             = 0;
     _scoreboard.Shadow = true;
 }
Пример #3
0
        public BillBoard(int xOffset, Color color)
        {
            Name       = "billboardd";
            _fontY     = -200;
            _fontX     = xOffset;
            _fontColor = color;

            _titles = new FontRender("Titles");
            _titles.LoadContent("titlescreen");
            _titles.Location = new Vector2(_fontX, _fontY);
            _titles.Shadow   = true;
        }
Пример #4
0
        protected override void LoadContent()
        {
            Window.AllowUserResizing = true;
            _logo.LoadContent("ExoEngineLogo");
            _logo.Location = new Vector2(550, 20);

            _titles.LoadContent("titles");
            _titles.Location = new Vector2(200, 800);
            _titles.Shadow   = true;
            _titles.Text     = "Exo Game 2D";

            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER1, _logo);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER2, _titles);
        }
Пример #5
0
        public OptionsMenu()
        {
            _crosshair  = new MenuCursor();
            _background = new Background();

            _titles = new FontRender("Titles");
            _titles.LoadContent("titlescreen");
            _titles.Location = new Vector2(150, _fontY);
            _titles.Shadow   = true;


            _container = new UIContainer("OptionsMenu");

            int startYPosition = 600;

            _soundEffectsOnOff = new CheckBox("SoundEffectsOnOff", new SoundEffectsOnOffHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "Sound Effects On/Off",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };

            ((CheckBox)_soundEffectsOnOff).Checked = SoundEffectPlayer.PlaySoundEffects;

            startYPosition += 80;

            _backToMainMenu = new Button("ExitToMainMenu", new ExitToMainMenuButtonHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "<-- Exit to Main Menu",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };


            _container.AddControl(_soundEffectsOnOff);
            _container.AddControl(_backToMainMenu);

            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER1, _background);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER2, _titles);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER5, _crosshair);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER4, _container);
        }
Пример #6
0
        protected override void Initialize()
        {
            base.Initialize();
            grid = new Grid(NumberCellsHorizontal, NumberCellsVertical)
            {
                Name = "Grid"
            };

            _helpFont.LoadContent("File");
            _helpFont.Location = new Vector2(20, 20);
            _helpFont.Shadow   = true;
            _helpFont.Text     = "Exo Game 2D - Conways Game of Life" + System.Environment.NewLine +
                                 "--------------------------------------------" + System.Environment.NewLine + System.Environment.NewLine +
                                 "<h> Toggle Help" + System.Environment.NewLine +
                                 "<f> Toggle Fullscreen" + System.Environment.NewLine +
                                 "<backspace> Clear grid" + System.Environment.NewLine +
                                 "<space> Pause cells" + System.Environment.NewLine;

            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER2, _helpFont);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER1, grid);
        }
Пример #7
0
        public MainMenu()
        {
            _crosshair  = new MenuCursor();
            _background = new Background();

            MusicPlayer.LoadMusic("banjo");

            _fontY  = -200;
            _titles = new FontRender("Titles");
            _titles.LoadContent("titlescreen");
            _titles.Location = new Vector2(150, _fontY);
            _titles.Shadow   = true;


            _container = new UIContainer("MainMenu");

            int startYPosition = 450;

            _playGameButton = new Button("PlayGameButton", new NewGameButtonHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "Play Duck Attack",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };

            startYPosition += 80;

            _optionsButton = new Button("OptionsGameButton", new OptionsButtonHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "Options",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };

            startYPosition += 80;

            _exitButton = new Button("ExitGameButton", new ExitButtonHandler())
            {
                Width            = 500,
                Height           = 70,
                Location         = new Vector2(700, startYPosition),
                Text             = "Exit Game",
                DrawWindowChrome = true,
                ControlTexture   = "ButtonBackground"
            };

            _container.AddControl(_playGameButton);
            _container.AddControl(_optionsButton);
            _container.AddControl(_exitButton);

            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER1, _background);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER2, _titles);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER5, _crosshair);
            _scene.AddSpriteToLayer(RenderLayerEnum.LAYER4, _container);

            MusicPlayer.Play("banjo");
            MusicPlayer.Looped = true;
        }