Beispiel #1
0
        public void Setup(WorldSpace world)
        {
            WorldWidth = world.WorldWidth;
            WorldHeight = world.WorldHeight;
            WorldDepth = world.WorldDepth;

            // Prefetch cells in an array sorted by z-buffer
            // depth = width + height + depth;
            positionedWorldCells = new List<PositionedWorldCell>[(WorldWidth + WorldHeight + WorldDepth)];

            for (int x = 0; x < WorldWidth; x++)
            {
                for (int y = 0; y < WorldHeight; y++)
                {
                    for (int z = 0; z < WorldDepth; z++)
                    {
                        var cell = world.GetAt(x, y, z);
                        var zbuffer = CalculateDistance(x, y, z);

                        if (positionedWorldCells[zbuffer] == null)
                            positionedWorldCells[zbuffer] = new List<PositionedWorldCell>();

                        for (int i = 0; i < cell.Tiles.Count; i++)
                        {
                            positionedWorldCells[zbuffer].Add(new PositionedWorldCell
                            {
                                Tile = cell.Tiles[i],
                                Position = CalculatePosition(cell)
                            });
                        }
                    }
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Warmup
 /// </summary>
 public void StretchWings()
 {
     _world = new WorldSpace();
     _tileRenderer = new TileRenderer();
 }