Exemplo n.º 1
0
        public Chunk(int x, int y, int width, int height, Map map)
        {
            X      = x;
            Y      = y;
            Width  = width;
            Height = height;

            Map = map;

            myTiles = new GameTile[width, height];

            for (int tx = 0; tx < Width; ++tx)
            {
                for (int ty = 0; ty < Height; ++ty)
                {
                    if (map.IsInterior)
                    {
                        myTiles[tx, ty] = new InteriorTile(X + tx, Y + ty, this, map);
                    }
                    else
                    {
                        myTiles[tx, ty] = new ExteriorTile(X + tx, Y + ty, this, map);
                    }
                }
            }

            myLighting = new LightColour[width + 1, height + 1];

            FillLighting(LightColour.Default);

            myEnts = new List <Entity>();

            myVB = new Rendering.VertexBuffer(map.IsExterior);

            LightSources = new List <Light>();

            myLightingChanged   = true;
            myTilesChanged      = true;
            myEntSortingChanged = true;

            myNeighbours = new Chunk[0];
        }
Exemplo n.º 2
0
        public void GenerateChunk(Chunk chunk)
        {
            for (int x = chunk.X; x < chunk.X + chunk.Width; ++x)
            {
                for (int y = chunk.Y; y < chunk.Y + chunk.Height; ++y)
                {
                    double height = GetHeight(x, y);
                    double temp   = GetTemperature(x, y);

                    ExteriorTile tile = chunk.GetTile(x, y) as ExteriorTile;
                    tile.IsWall = false;

                    if (height >= 0.25)
                    {
                        if (height >= 0.5)
                        {
                            tile.Skin = 3;
                        }
                        else
                        {
                            tile.Skin = 1;
                        }

                        tile.WallHeight = 1;
                    }
                    else if (height >= -1.0 && temp < 0.25)
                    {
                        tile.Skin = 1;
                    }
                    else if (height < -0.5 && temp < 0.25)
                    {
                        tile.Skin = 2;
                    }
                    else
                    {
                        tile.Skin = 0;
                    }
                }
            }

            chunk.UpdateTiles();
        }
Exemplo n.º 3
0
 public ExteriorMaterialInfo(ExteriorTile tile)
     : base(tile)
 {
 }