예제 #1
0
 public void Draw(SpriteBatch spritebatch)
 {
     foreach (Rectangle rectangle in list)
     {
         spritebatch.Draw(Content_Manager.getInstance().Textures["Block"], rectangle, Color.White);
     }
 }
예제 #2
0
        public ScreenManager(GameType gametype, Game1 game)
        {
            menubase        = new Menu_Base(Content_Manager.getInstance().Textures["menubase"]);
            menuoptions     = new Menu_Options(Content_Manager.getInstance().Textures["menuoptions"]);
            menuplay        = new Menu_Play(Content_Manager.getInstance().Textures["menuplay"]);
            menuSolo        = new Menu_Play_Solo(Content_Manager.getInstance().Textures["menusolo"]);
            menusolo1       = new Menu_Play_Solo_World1(Content_Manager.getInstance().Textures["solo1"]);
            menusolo2       = new Menu_Play_Solo_World2(Content_Manager.getInstance().Textures["solo2"]);
            menuMulti       = new Menu_Play_Multi(Content_Manager.getInstance().Textures["menumulti"]);
            menupauseoption = new Menu_Pause_Options(Content_Manager.getInstance().Textures["menupauseoption"]);
            casper          = new Casper(Content_Manager.getInstance().Textures["Casper"], new Rectangle(0, 0, 16, 34));
            player2         = new Casper(Content_Manager.getInstance().Textures["Casper"], new Rectangle(50, 50, 16, 34));
            casper2         = new Casper(Content_Manager.getInstance().Textures["Player1"], new Rectangle(50, 50, 0, 0));
            controls        = new Controls(casper.Position, casper.Velocity, casper.Speed, Keys.W, Keys.A, Keys.D, Keys.S);
            controlsPlayer2 = new Controls(player2.Position, player2.Velocity, player2.Speed, Keys.Up, Keys.Left, Keys.Right, Keys.Down);
            controlsWorld2  = new Controls(casper2.Position, casper2.Velocity, casper2.Speed, Keys.Up, Keys.Left, Keys.Right, Keys.Down);
            world2vert1     = new Decors(Content_Manager.getInstance().Textures["vert"], new Rectangle(-1680, 0, 1680, 1050));
            world2vert2     = new Decors(Content_Manager.getInstance().Textures["vert"], new Rectangle(1680, 0, 1680, 1050));


            camera           = new Camera(Game1.GetGame().GraphicsDevice.Viewport);
            game.casperr     = casper;
            decors           = new Decors(Content_Manager.getInstance().Textures["Level1"], new Rectangle(0, 0, 1680, 1050));
            decors1          = new Decors(Content_Manager.getInstance().Textures["Level1"], new Rectangle(1680, 0, 1680, 1050));
            decors2          = new Decors(Content_Manager.getInstance().Textures["Level1"], new Rectangle(-1680, 0, 1680, 1050));
            world2           = new Decors(Content_Manager.getInstance().Textures["world2"], new Rectangle(0, 0, 1680, 1050));
            menupause        = new Menu_Pause(Content_Manager.getInstance().Textures["menupause"]);
            level1           = new Level1(new Vector2(0, 0));
            obstacles        = new Obstacles(level1.getList());
            previousgametype = GameType.Exit;

            this.gametype = gametype;
        }
예제 #3
0
 public static Content_Manager getInstance()
 {
     if (instance == null)
     {
         instance = new Content_Manager();
     }
     return(instance);
 }
예제 #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Content_Manager.getInstance().LoadTextures(Content);
            fontdebug = Content.Load <SpriteFont>("Fontdebug");
            //casperr = new Casper(Content_Manager.getInstance().Textures["Casper"], new Rectangle(400, 500, 130, 130));
            //decors = new Decors(Content_Manager.getInstance().Textures["Level1"], new Rectangle(0, 0, 1680, 1050));

            SoundManager.LoadContent(Content);
            MediaPlayer.Play(SoundManager.menu);
            MediaPlayer.IsRepeating = true;
            screenmanager           = new ScreenManager(gameState, this);
            camera = screenmanager.camera;

            // TODO: use this.Content to load your game content here
        }
예제 #5
0
 public static Content_Manager getInstance()
 {
     if (instance == null)
         instance = new Content_Manager();
     return instance;
 }
예제 #6
0
 public Texture2D getText(State state, GameType gametype)
 {
     if (gametype == GameType.Menu_Play_Solo_world1_lvl1 || gametype == GameType.Menu_Play_Multi_Type)
     {
         if (state == State.Basic)
         {
             texture = Content_Manager.getInstance().Textures["Casper"];
         }
         else if (state == State.Right)
         {
             if (delta < 15)
             {
                 texture = Content_Manager.getInstance().Textures["Casper/CasperDroite1"];
             }
             else if (delta < 30)
             {
                 texture = Content_Manager.getInstance().Textures["Casper/CasperDroite2"];
             }
             else if (delta < 45)
             {
                 texture = Content_Manager.getInstance().Textures["Casper/CasperDroite3"];
             }
             else if (delta < 60)
             {
                 texture = Content_Manager.getInstance().Textures["Casper/CasperDroite4"];
             }
         }
         else if (state == State.Left)
         {
             if (delta < 15)
             {
                 texture = Content_Manager.getInstance().Textures["Casper/CasperGauche1"];
             }
             else if (delta < 30)
             {
                 texture = Content_Manager.getInstance().Textures["Casper/CasperGauche2"];
             }
             else if (delta < 45)
             {
                 texture = Content_Manager.getInstance().Textures["Casper/CasperGauche3"];
             }
             else if (delta < 60)
             {
                 texture = Content_Manager.getInstance().Textures["Casper/CasperGauche4"];
             }
         }
         else if (state == State.TopRight)
         {
             texture = Content_Manager.getInstance().Textures["Casper/CasperDroiteSaut"];
         }
         else if (state == State.TopLeft)
         {
             texture = Content_Manager.getInstance().Textures["Casper/CasperGaucheSaut"];
         }
         else if (state == State.Top)
         {
             texture = Content_Manager.getInstance().Textures["Casper/CasperSaut"];
         }
         else if (state == State.Falling)
         {
             texture = Content_Manager.getInstance().Textures["Casper/CasperFall"];
         }
     }
     else if (gametype == GameType.Menu_Play_Solo_world2_lvl1)
     {
         if (state == State.Basic)
         {
             texture = Content_Manager.getInstance().Textures["Player1"];
         }
         else if (state == State.Right)
         {
             if (delta < 15)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerDroite1"];
             }
             else if (delta < 30)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerDroite2"];
             }
             else if (delta < 45)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerDroite3"];
             }
             else if (delta < 60)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerDroite4"];
             }
         }
         else if (state == State.Left)
         {
             if (delta < 15)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerGauche1"];
             }
             else if (delta < 30)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerGauche2"];
             }
             else if (delta < 45)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerGauche3"];
             }
             else if (delta < 60)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerGauche4"];
             }
         }
         else if (state == State.Top)
         {
             if (delta < 15)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerHaut1"];
             }
             else if (delta < 30)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerHaut2"];
             }
             else if (delta < 45)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerHaut3"];
             }
             else if (delta < 60)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerHaut4"];
             }
         }
         else if (state == State.Falling)
         {
             if (delta < 15)
             {
                 texture = Content_Manager.getInstance().Textures["Player1"];
             }
             if (delta < 30)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerBas2"];
             }
             else if (delta < 45)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerBas3"];
             }
             else if (delta < 60)
             {
                 texture = Content_Manager.getInstance().Textures["PlayerBas4"];
             }
         }
     }
     return(texture);
 }