Implement basic networking
This commit is contained in:
parent
c320d9ddcb
commit
994823a9c3
25 changed files with 643 additions and 217 deletions
|
|
@ -4,10 +4,10 @@ using Godot;
|
|||
|
||||
public class TestGenerator : IGenerator
|
||||
{
|
||||
public static Vector3I UNIVERSE_SIZE = new(100, 100, 100);
|
||||
public static Vector3 SECTOR_SIZE = new(5000, 5000, 5000);
|
||||
public static int STARS_PER_SECTOR = 100;
|
||||
public static int STARS_PER_SECTOR_VARIANCE = 5;
|
||||
public static Vector3I UNIVERSE_SIZE = new(10, 10, 10);
|
||||
public static Vector3 SECTOR_SIZE = new(50, 50, 50);
|
||||
public static int STARS_PER_SECTOR = 1;
|
||||
public static int STARS_PER_SECTOR_VARIANCE = 0;
|
||||
public static int SHIPS_PER_SECTOR = 0;
|
||||
public static int SHIPS_PER_SECTOR_VARIANCE = 0;
|
||||
public static int STATIONS_PER_SECTOR = 0;
|
||||
|
|
@ -22,7 +22,12 @@ public class TestGenerator : IGenerator
|
|||
return UNIVERSE_SIZE;
|
||||
}
|
||||
|
||||
public Vector3I GetSectorOffset()
|
||||
public Vector3 GetSectorSize()
|
||||
{
|
||||
return SECTOR_SIZE;
|
||||
}
|
||||
|
||||
public Vector3I GetSectorOffset(Vector3I universeSize)
|
||||
{
|
||||
return new(
|
||||
(int)Mathf.Floor(UNIVERSE_SIZE.X / 2),
|
||||
|
|
@ -31,9 +36,31 @@ public class TestGenerator : IGenerator
|
|||
);
|
||||
}
|
||||
|
||||
public Vector3 GetSectorSize()
|
||||
public Vector3I GetSectorOffset()
|
||||
{
|
||||
return SECTOR_SIZE;
|
||||
return GetSectorOffset(UNIVERSE_SIZE);
|
||||
}
|
||||
|
||||
public Universe InitializeEmptyUniverse(Vector3I universeSize, Vector3 sectorSize)
|
||||
{
|
||||
Universe universe = new(universeSize);
|
||||
|
||||
for (int x = 0; x < universeSize.X; x++)
|
||||
{
|
||||
for (int y = 0; y < universeSize.Y; y++)
|
||||
{
|
||||
for (int z = 0; z < universeSize.Z; z++)
|
||||
{
|
||||
universe.Sectors[x, y, z] = new Sector(
|
||||
new(x, y, z),
|
||||
GetSectorOffset(universeSize),
|
||||
sectorSize
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return universe;
|
||||
}
|
||||
|
||||
public Universe GenerateUniverse()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue