using System; using Godot; public class Universe { public Sector[,,] Sectors; public Universe(Vector3I size) { Sectors = new Sector[size.X, size.Y, size.Z]; } public Universe(int sizeX, int sizeY, int sizeZ) { Sectors = new Sector[sizeX, sizeY, sizeZ]; } public Sector GetSector(Vector3I coordinates) { return Sectors[coordinates.X, coordinates.Y, coordinates.Z]; } public Sector GetSector(int x, int y, int z) { return Sectors[x, y, z]; } public void ForEachSector(Action action) { int sizeX = Sectors.GetLength(0); int sizeY = Sectors.GetLength(1); int sizeZ = Sectors.GetLength(2); for (int x = 0; x < sizeX; x++) { for (int y = 0; y < sizeY; y++) { for (int z = 0; z < sizeZ; z++) { action(Sectors[x, y, z]); } } } } }