示例#1
0
 public void Start(ContentManager Content, World World, MouseManager Mouse, ScreemController ScreemController)
 {
     this._Screem     = ScreemController;
     this.Sprite      = Content.Load <Texture2D>("Sprites/UI/return");
     this._bodySize   = new Vector2(this.Sprite.Height, this.Sprite.Width);
     this.TextureSize = this._bodySize;
     this._Mouse      = Mouse;
     this.SetBoxCollision(World);
     this.CBody.Tag = "Reload";
 }
示例#2
0
        public void Start(ContentManager Content, MouseManager Mouse, ScreemController ScreemController)
        {
            this.Content = Content;
            this.Mouse   = Mouse;
            this.Screem  = ScreemController;

            if (this.ReloadShow)
            {
                this.Reload = new Reload();
                this.Reload.Start(Content, World, Mouse, ScreemController);
                this.UI.Add(this.Reload);
            }

            if (this.MusicShow)
            {
                if (this.Music == null)
                {
                    this.Music = new Music();
                }
                this.Music.GameManager = this.GameManager;
                this.Music.Hud         = this;
                this.Music.Start(Content, World, Mouse, ScreemController);
                this.UI.Add(this.Music);
            }

            if (this.ResizeShow && this.Resize == null)
            {
                this.Resize = new Resize();
                this.Resize.Start(Content, World, Mouse, ScreemController);
                this.UI.Add(this.Resize);
            }


            if (this.BackShow)
            {
                if (this.Back == null)
                {
                    this.Back = new BackBTN();
                }
                this.Back.Start(Content, World, Mouse, ScreemController);
                this.UI.Add(this.Back);
            }

            if (this.HomeShow)
            {
                this.Home             = new Home();
                this.Home.GameManager = this.GameManager;
                this.Home.Hud         = this;
                this.Home.Start(Content, World, Mouse, ScreemController);
                this.UI.Add(this.Home);
            }

            this.SetBackgroundColor = Color.Transparent;
            this.LevelReady         = true;
        }
示例#3
0
 public void Start(ContentManager Content, World World, MouseManager Mouse, ScreemController ScreemController)
 {
     this._Screem        = ScreemController;
     this.SpriteFull     = Content.Load <Texture2D>("Sprites/UI/larger");
     this.SpriteWindowed = Content.Load <Texture2D>("Sprites/UI/smaller");
     this._bodySize      = new Vector2(this.SpriteFull.Height, this.SpriteFull.Width);
     this.TextureSize    = this._bodySize;
     this._Mouse         = Mouse;
     this.Position       = new Vector2(this._Screem.getCurrentResolutionSize.X - this.SpriteWindowed.Width, this.SpriteWindowed.Height);
     this.SetBoxCollision(World);
     this.CBody.Tag      = "Resize";
     this.CBody.BodyType = BodyType.Static;
 }
示例#4
0
 public void Start(ContentManager Content, World World, MouseManager Mouse, ScreemController ScreemController)
 {
     this._Screem     = ScreemController;
     this.MusicOn     = Content.Load <Texture2D>("Sprites/UI/musicOn");
     this.MusicOff    = Content.Load <Texture2D>("Sprites/UI/musicOff");
     this.Sprite      = this.MusicOn;
     this._bodySize   = new Vector2(this.Sprite.Height, this.Sprite.Width);
     this.TextureSize = this._bodySize;
     this._Mouse      = Mouse;
     this.Position    = new Vector2(this._Screem.getCenterScreem.X - 60f, this.Sprite.Height);
     this.SetBoxCollision(World);
     this.CBody.Tag      = "Music";
     this.CBody.BodyType = BodyType.Static;
 }
示例#5
0
        protected override void LoadContent()
        {
            spriteBatch      = new SpriteBatch(GraphicsDevice);
            ScreemController = new ScreemController(graphics, graphics.GraphicsDevice.Adapter, GraphicsDevice, 0);

            // check game progress
            this.CheckFirstSettings();

            GameManager        = new Managers.GameManager(Content, ScreemController, Storage, this);
            GameManager.Screem = ScreemController;

            _spriteBatchEffect = new BasicEffect(graphics.GraphicsDevice);
            _spriteBatchEffect.TextureEnabled = true;

            Location = Content.Load <LocalizationDefinitions>("Languages");
        }
示例#6
0
        protected override void LoadContent()
        {
            spriteBatch      = new SpriteBatch(GraphicsDevice);
            Scene            = new Scene();
            ScreemController = new ScreemController(graphics, graphics.GraphicsDevice.Adapter, GraphicsDevice, 0);

            AssetManagement       = new AssetManagement();
            AssetManagement.Scene = this.Scene;

            // Player
            AssetManagement.Set <Player>("player");

            // Enemies
            AssetManagement.Set <Knight>("knight");
            AssetManagement.Set <Troll>("troll");
            AssetManagement.Set <TrollPoint>("troll_point");
            AssetManagement.Set <AirEnemyPoint>("air_attack_point");

            // Stairs
            AssetManagement.Set <Gameplay.UpStairsRight>("hitbox_upstairs_right");
            AssetManagement.Set <Gameplay.UpStairsLeft>("hitbox_upstairs_left");
            AssetManagement.Set <Gameplay.DownStairsLeft>("hitbox_downstairs_left");
            AssetManagement.Set <Gameplay.DownStairsRight>("hitbox_downstairs_right");

            Scene.ScreemOffset         = new Vector2(400, 240);
            Scene.AssetManagement      = this.AssetManagement;
            Scene.Content              = Content;
            Scene.ScreemGraphicsDevice = GraphicsDevice;
            Scene.Screem             = ScreemController;
            Scene.World              = new World(new Vector2(0, 10));
            Scene.SetBackgroundColor = Color.CornflowerBlue;
            Scene.SetLevel(1);
            Scene.LevelReady = true;

            CameraManagement = new CameraManagement();
            CameraManagement.ScreemTargetAreaLimits = new Vector2(100, 100);
            CameraManagement.MoveSpeed        = 5f;
            ScreemController.CameraManagement = CameraManagement;
            ScreemController.Scene            = Scene;
        }
        public void StartLevel()
        {
            if (this.CurrentlyLevel > 0)
            {
                this.StartSound();
            }
            if (this.SceneUI == null)
            {
                this.SceneUI             = new Hud();
                this.SceneUI.World       = this.WorldUIMainMenu;
                this.SceneUI.GameManager = this;
                this.SceneUI.Start(this.Content, this.Mouse, this.Screem);
            }

            this.SceneLevel          = this.Levels[this.CurrentlyLevel];
            this.SceneLevel.Screem   = this.Screem;
            this.SceneLevel.Storage  = this.Storage;
            this.SceneLevel.FontBold = this.FontBold;
            this.SceneLevel.Start(Content, World, Mouse);

            this.SceneUI.SetLevel(this.SceneLevel);

            this.SaveProgress(this.CurrentlyLevel);
        }
        public GameManager(ContentManager Content, ScreemController ScreemController, UmbrellaToolKit.Storage.Load Storage, Game1 Game)
        {
            this.Storage   = Storage;
            CurrentlyLevel = 0;

            this.Content = Content;
            this.Screem  = ScreemController;
            this.Game    = Game;

            this.FontBold     = Content.Load <SpriteFont>("Fonts/Quicksand-Bold");
            this.FontRegular  = Content.Load <SpriteFont>("Fonts/Quicksand-Regular");
            this.Localization = Content.Load <LocalizationDefinitions>("Languages");

            this.World         = new World();
            this.World.Gravity = new Vector2(0, 10);

            this.MusicSoundTrack        = Content.Load <SoundEffect>("Sound/kalimba-relaxation-music-by-kevin-macleod-from-filmmusic-io");
            this.soundInstance          = this.MusicSoundTrack.CreateInstance();
            this.soundInstance.Volume   = 0.1f;
            this.soundInstance.IsLooped = true;

            this.Mouse        = new MouseManager();
            this.MouseWhite   = Content.Load <Texture2D>("Sprites/UI/upLeft_white");
            this.MouseBlack   = Content.Load <Texture2D>("Sprites/UI/upLeft");
            this.Mouse.Sprite = this.MouseWhite;
            this.Mouse.SetPointMouse(this.World);
            this.Mouse.Show = true;

            this.WorldUIMainMenu         = new World();
            this.WorldUIMainMenu.Gravity = Vector2.Zero;
            this.Mouse.SetPointMouse(WorldUIMainMenu);

            this.SetAllLevels(Content);
            this.SetCreditsScene();

            this.SceneMainMenu              = new MainMenu();
            this.SceneMainMenu.Content      = this.Content;
            this.SceneMainMenu.Font         = this.FontRegular;
            this.SceneMainMenu.FontBold     = this.FontBold;
            this.SceneMainMenu.Screem       = this.Screem;
            this.SceneMainMenu.World        = this.World;
            this.SceneMainMenu.Mouse        = this.Mouse;
            this.SceneMainMenu.Screem       = this.Screem;
            this.SceneMainMenu.Game         = this.Game;
            this.SceneMainMenu.Localization = this.Localization;
            this.SceneMainMenu.Storage      = this.Storage;
            this.SceneMainMenu.GameManager  = this;

            List <bool>        levels           = this.Storage.getItemsBool("Progress");
            IEnumerable <bool> _levels_progress = from level in levels where level == true select level;

            if (_levels_progress.ToList <bool>().Count == 0)
            {
                this.CurrentlyStatus = GameStatus.PLAY;
            }
            else
            {
                this.SceneMainMenu.Start();
                this.CurrentlyStatus = GameStatus.MAIN_MENU;
            }
        }
        public void Update(GameTime gameTime)
        {
            for (int i = 0; i < 4; i++)
            {
                this.World.Step(Math.Min((float)gameTime.ElapsedGameTime.TotalMilliseconds, (1f / 30f)));
            }

            if (!this._IntialCredits)
            {
                this.Mouse.Show = true;
                switch (this.CurrentlyStatus)
                {
                case GameStatus.PLAY:
                    if (this.Levels[this.CurrentlyLevel].LevelReady == false)
                    {
                        this.StartLevel();
                    }
                    this.SceneLevel.UpdateLevel(gameTime);
                    this.SceneUI.Update(gameTime);

                    //change Color Mouse
                    if (this.SceneLevel.WhiteUI)
                    {
                        this.Mouse.Sprite = this.MouseWhite;
                    }
                    else
                    {
                        this.Mouse.Sprite = this.MouseBlack;
                    }

                    if (this.SceneLevel.Finished && this.CurrentlyLevel == 0)
                    {
                        this._IntialCredits = true;
                    }
                    else if (this.SceneLevel.Finished && this.CurrentlyLevel < this.Levels.Count() - 1)
                    {
                        this.Levels[this.CurrentlyLevel].Destroy();
                        this.CurrentlyLevel++;
                        this.StartLevel();
                    }
                    else if (this.SceneLevel.Finished && this.CurrentlyLevel == this.Levels.Count() - 1)
                    {
                        this.GoToCreditsArea();
                    }

                    break;

                case GameStatus.MAIN_MENU:
                    this.Mouse.Sprite = this.MouseBlack;
                    this.SceneMainMenu.Update(gameTime);
                    break;
                }
            }
            else
            {
                this.Mouse.Show     = false;
                this.Credits.Screem = this.Screem;
                this.CreditsScene.Update(gameTime);
                if (this.Credits.Finished)
                {
                    this._IntialCredits = false;
                    this.SceneLevel.Destroy();
                    this.CurrentlyLevel++;
                    this.SceneLevel = this.Levels[this.CurrentlyLevel];
                    this.StartLevel();
                }
            }
            this.Mouse.Update(gameTime);
        }