Beispiel #1
0
 public Ground(Game game, Map map)
     : base(game)
 {
     SourceMap = map;
     waterlevel = Convert.ToInt32(Map.WATER_LEVEL * LoadMap.taille / LoadMap.ajustZ);
     this.Visible = false;
 }
Beispiel #2
0
        public Game1()
        {
            //Map.MAPSIZE = 513;
            //  ParticleSimple ps;
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            //camera =  new Camera(this);

            ls.Add(Sens.Droite);
            ls.Add(Sens.Gauche);
            camera.actucamera(ls);
            //graphics.ToggleFullScreen();
            graphics.PreferredBackBufferWidth = Tools.Quick.screen.Bounds.Width;
            graphics.PreferredBackBufferHeight = Tools.Quick.screen.Bounds.Height;
            Tools.Quick.bounds.X = graphics.PreferredBackBufferWidth;
            Tools.Quick.bounds.Y = graphics.PreferredBackBufferHeight;
            particleManager = new ParticleManager(this);
            Tools.Quick.game = this;
            mousy = new ActionMouse(this, camera);
            Tools.Quick.actmouse = mousy;
            water = new Water(this);
            skybox = new SkyBox(this);
            trees = new Trees(this);
            d = new Dungeon(25, this);

            Map map = new Map();
            actualGround = new Ground(this, map);

            world = new WorldSpace(this);
            dungeon = new WorldSpace(this);
        }
Beispiel #3
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            this.IsMouseVisible = true;
            //  graphics.ToggleFullScreen();
            Tools.Quick.content = Content;
            Tools.Quick.device = graphics.GraphicsDevice;
            Tools.Quick.graphics = graphics;
            Tools.Quick.init();
            Tools.Quick.spriteBatch = spriteBatch;
            Map map = new Map();
            map.GenMap();

            //MapGen.MapConverter.Init();

            //MapGen.MapVoronoi v = new MapGen.MapVoronoi(245);
            //v.Generate();
            //v.Convert();

            effect = new BasicEffect(graphics.GraphicsDevice);
            actualGround = LoadMap.loadground(map);
            texture = Tools.Quick.groundTexture[BiomeType.SubtropicalDesert];
            testgivre = Content.Load<Texture2D>("givre");
            //water.SetGround(actualGround);
            trees.SetGround(actualGround);
            trees.CreateTrees();

            //element a supprimer cause de test
            myModel = Content.Load<Model>("Models\\sapin");
            // myModel = Content.Load<Model>("Models\\untitled");
            display.init();
            camera.modiposition(actualGround.tiles[1].v2, true);
            phgest = new PhysicsGest(actualGround, new List<Object>());
            camera.modiposition(actualGround.tiles[0].v1, true);
            // TODO: use this.Content to load your game content here
            //ps = new ParticleSimple(Content, this, Components);
            //psinit();
            //psLoadContent(Content);

            arial = Content.Load<SpriteFont>("Arial");
            // menu = new Menu(arial, TypeMenu.Principal);

            Tools.Quick.player = new Personnage("Test", true, 0, new Inventory(), myModel);
            //d = new Dungeon();
            inf = new InventoryInterface(Content.Load<Texture2D>("InterfaceComponent\\Cadre"), Content.Load<Texture2D>("InterfaceComponent\\cadre bois"), Content.Load<Texture2D>("Test\\Mannequin"), Content.Load<Texture2D>("InterfaceComponent\\fond bois"), this);
            //d.setVisible(false);
            //Components.Add(d);
            base.LoadContent();
        }
Beispiel #4
0
        public static void loadground(Map map, Ground source)
        {
            Ground gnd;
            List<Tile> lts = new List<Tile>();
            Tile t;

            for (int i = 0; i < Map.MAPSIZE; i++)
            {
                for (int j = 0; j < Map.MAPSIZE; j++)
                {
                    //int suivi = x + 1;
                    //int suivj = y + 1;
                    //if (suivi <= Map.MAPSIZE)
                    //{
                    //    if (suivj <= Map.MAPSIZE)
                    //    {
                    int h1, h2, h3, h4;
                    h1 = map.HeightMap[i, j];
                    h2 = j + 1 == Map.MAPSIZE ? 0 : map.HeightMap[i, j + 1];
                    h3 = (i + 1 == Map.MAPSIZE) || (j + 1 == Map.MAPSIZE) ? 0 : map.HeightMap[i + 1, j + 1];
                    h4 = i + 1 == Map.MAPSIZE ? 0 : map.HeightMap[i + 1, j];
                    t = new Tile(new Vector3(i * taille, h1 * taille / ajustZ, j * taille),
                        new Vector3(i * taille, h2 * taille / ajustZ, (j + 1) * taille),
                        new Vector3((i + 1) * taille, h3 * taille / ajustZ, (j + 1) * taille),
                        new Vector3((i + 1) * taille, h4 * taille / ajustZ, j * taille),
                        map.BiomeMap[i,j]);
                    lts.Add(t);
                    //    }
                    //}

                }
            }

            for (int i = 0; i < lts.Count; i++)
            {
                Tile[,] calc = new Tile[3, 3];
                Tile tmp = lts[i];
                Tile ttmp;
                int msize = Map.MAPSIZE;

                tmp.n3 = tmp.normal1 + tmp.normal2;
                tmp.n1 = tmp.normal1 + tmp.normal2;
                tmp.n4 = tmp.normal1;
                tmp.n2 = tmp.normal2;

                if (i >= msize)
                {
                    ttmp = lts[i - (msize - 2)];
                    tmp.n1 += ttmp.normal1;
                    tmp.n2 += ttmp.normal1 + ttmp.normal2;
                    if (i % (msize) != 0)
                    {
                        ttmp = lts[i - msize];
                        tmp.n1 += ttmp.normal1 + ttmp.normal2;
                    }
                    if (i % (msize - 1) != 0)
                        tmp.n2 += lts[i - msize + 2].normal1;
                }
                if (i < (msize - 1) * (msize - 1) - msize)
                {
                    ttmp = lts[i + (msize - 2)];
                    tmp.n3 += ttmp.normal2;
                    tmp.n4 += ttmp.normal1 + ttmp.normal2;
                    if (i % (msize) != 0)
                        tmp.n4 += lts[i + msize - 2].normal2;
                    if (i % (msize - 1) != 0)
                    {
                        ttmp = lts[i + msize];
                        tmp.n3 += ttmp.normal1 + ttmp.normal2;
                    }
                }
                if (i % (msize) != 0)
                {
                    ttmp = lts[i - 1];
                    tmp.n4 += ttmp.normal2 + ttmp.normal1;
                    tmp.n1 += ttmp.normal2;
                }
                if (i % (msize - 1) != 0)
                {
                    ttmp = lts[i + 1];
                    tmp.n2 += ttmp.normal2 + ttmp.normal1;
                    tmp.n3 += ttmp.normal1;
                }
                tmp.n1.Normalize();
                tmp.n2.Normalize();
                tmp.n3.Normalize();
                tmp.n4.Normalize();
            }

            //lts.Reverse();
            source.SetGroundMap(lts, map.HeightMap);
        }
Beispiel #5
0
 public void save()
 {
     Map map = new Map();
     map.GenMap();
     map.SaveImage("map");
 }
Beispiel #6
0
 public void save(Game1 game , Map map)
 {
 }