Beispiel #1
0
 public void parametrage(ref levelProfile level)
 {
     this.speed = level.player_speed;
     speedbullet = level.bullet_speed;
     this.color_V = level.color;
     damage = level.damage;
     this.vie = level.playerLife;
     timer = level.firerate;
     timer1 = timer / 2;
     timer2 = timer;
     maxspeed = (int)((float)speed * 1.5f);
     minspeed = speed;
 }
        public void Load(ContentManager Content, levelProfile levelprofile, GraphicsDevice graph)
        {
            speed[1] = levelprofile.fc_speed / 2;
            speed[2] = levelprofile.fc_speed / 3;
            speed[0] = levelprofile.fc_speed;
            string name = string.Empty;
            for (int i = 0; i < levelprofile.background_name.Length && levelprofile.background_name[i] != '.'; ++i)
            {

                name += levelprofile.background_name[i];
                if (levelprofile.background_name[i] == '\\')
                    name = "";
            }
            if (name == "backgroundT")// si c est un jeu normal
            {

                texture[count] = (Content.Load<Texture2D>(levelprofile.levelname + "\\" + levelprofile.background_name));
                rec1[count] = new Rectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
                rec2[count] = new Rectangle(rectangle.X, -rectangle.Height, rectangle.Width, rectangle.Height);
                couche[count] = 0.9f;
                ++count;
            }
            else if (name == "BackgrounD")// si c est un jeu perso
            {
                Sauveguarde save = new Sauveguarde();
                FileStream file = new FileStream(save._path + "\\SEU\\" + levelprofile.levelname + "\\" + levelprofile.background_name, FileMode.Open, FileAccess.Read);
                texture[count] = (Texture2D.FromStream(graph, file));
                rec1[count] = new Rectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
                rec2[count] = new Rectangle(rectangle.X, -rectangle.Height, rectangle.Width, rectangle.Height);
                couche[count] = 0.5f;

                //    scroll.Add(new Scrolling(texture[texture.Count - 1], new Rectangle(0, 0, windows_W, window_H), levelprofile.fc_speed, window_H, 0.5f));
                ++count;
            }
            else
            {
                texture[count] = (Content.Load<Texture2D>("level2\\fond"));
                rec1[count] = new Rectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
                rec2[count] = new Rectangle(rectangle.X, -rectangle.Height, rectangle.Width, rectangle.Height);
                couche[count] = 0.5f;
                //     scroll.Add(new Scrolling(texture[texture.Count - 1], new Rectangle(0, 0, windows_W, window_H), levelprofile.fc_speed, window_H, 0.5f));
                ++count;
            }

            if (levelprofile.second_background != null)
            {
                texture[count] = (Content.Load<Texture2D>("back\\" + levelprofile.second_background));
                rec1[count] = new Rectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
                rec2[count] = new Rectangle(rectangle.X, -rectangle.Height, rectangle.Width, rectangle.Height);
                couche[count] = 0.7f;
                //  scroll.Add(new Scrolling(texture[texture.Count - 1], new Rectangle(0, 0, windows_W, window_H), speed1, window_H, 0.9f));
                ++count;
            }
            if (levelprofile.third_bacground != null)
            {
                texture[count] = (Content.Load<Texture2D>("back\\" + levelprofile.third_bacground));
                rec1[count] = new Rectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
                rec2[count] = new Rectangle(rectangle.X, -rectangle.Height, rectangle.Width, rectangle.Height);
                couche[count] = 0.1f;
                //   scroll.Add(new Scrolling(texture[texture.Count - 1], new Rectangle(0, 0, windows_W, window_H), speed2, window_H, 1f));
                ++count;
            }
        }