|
|
@ -124,14 +124,12 @@ namespace GWConquest |
|
|
|
|
|
|
|
var planet = planetGO.GetComponent<Planet>(); |
|
|
|
var planetName = DrawName(); |
|
|
|
planet.State.PlanetName = planetName; |
|
|
|
planet.PlanetName = planetName; |
|
|
|
|
|
|
|
planetGO.name = planetName; |
|
|
|
|
|
|
|
int prefabId = Random.Range(0, PlanetPrefabs.Length); |
|
|
|
planet.State.PlanetPrefab = prefabId; |
|
|
|
planet.State.PrefabRotation = Random.rotationUniform; |
|
|
|
planet.State.PrefabScale = Random.Range(MinPlanetScale, MaxPlanetScale); |
|
|
|
planet.SetPrefabProperties((ushort) prefabId, Random.rotationUniform, Random.Range(MinPlanetScale, MaxPlanetScale)); |
|
|
|
|
|
|
|
InitPlanetPrefab(planet); |
|
|
|
|
|
|
@ -152,13 +150,13 @@ namespace GWConquest |
|
|
|
|
|
|
|
public void InitPlanetPrefab(Planet planet) |
|
|
|
{ |
|
|
|
var prefab = PlanetPrefabs[planet.State.PlanetPrefab]; |
|
|
|
var prefab = PlanetPrefabs[planet.PrefabID]; |
|
|
|
var sphereGO = Instantiate(prefab); |
|
|
|
sphereGO.transform.SetParent(planet.transform); |
|
|
|
sphereGO.transform.localPosition = Vector3.zero; |
|
|
|
sphereGO.transform.localRotation = planet.State.PrefabRotation; |
|
|
|
sphereGO.transform.localRotation = planet.PrefabRotation; |
|
|
|
|
|
|
|
float scale = planet.State.PrefabScale * prefab.transform.localScale.x; |
|
|
|
float scale = planet.PrefabScale * prefab.transform.localScale.x; |
|
|
|
sphereGO.transform.localScale = scale * Vector3.one; |
|
|
|
|
|
|
|
planet.PrefabObject = sphereGO; |
|
|
@ -228,7 +226,7 @@ namespace GWConquest |
|
|
|
string nameCandidate; |
|
|
|
if(type == DistrictType.Civil) |
|
|
|
{ |
|
|
|
nameCandidate = planet.State.PlanetName + " " + PlanetRegistry.CivilNames[i]; |
|
|
|
nameCandidate = planet.PlanetName + " " + PlanetRegistry.CivilNames[i]; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
@ -252,7 +250,7 @@ namespace GWConquest |
|
|
|
zone.zoneType = ZoneType.Ground; |
|
|
|
nextZoneId++; |
|
|
|
|
|
|
|
district.State.Planet = BoltEntityCache.Set(planet); |
|
|
|
district.SetPlanet(planet); |
|
|
|
|
|
|
|
var otherDistricts = planet.GetComponentsInChildren<District>().ToList(); |
|
|
|
|
|
|
@ -260,8 +258,8 @@ namespace GWConquest |
|
|
|
{ |
|
|
|
var otherDistrict = otherDistricts[0]; |
|
|
|
|
|
|
|
district.ConnectionList.Add(otherDistrict.entity); |
|
|
|
otherDistrict.ConnectionList.Add(district.entity); |
|
|
|
district.AddConnection(otherDistrict); |
|
|
|
otherDistrict.AddConnection(district); |
|
|
|
|
|
|
|
otherDistricts.RemoveAt(0); |
|
|
|
|
|
|
@ -399,7 +397,7 @@ namespace GWConquest |
|
|
|
{ |
|
|
|
float connLength = conn.GetLength(); |
|
|
|
int planetCount = Mathf.RoundToInt( Random.Range(connLength / MaxPlanetDistance, connLength / MinPlanetDistance) ) - 1; |
|
|
|
BoltLog.Info("Spawning {0} planets between {1} and {2}", planetCount, conn.planet1.planetName, conn.planet2.planetName); |
|
|
|
BoltLog.Info("Spawning {0} planets between {1} and {2}", planetCount, conn.planet1.PlanetName, conn.planet2.PlanetName); |
|
|
|
|
|
|
|
Vector3 start = conn.planet1.transform.position; |
|
|
|
Vector3 dir = conn.planet2.transform.position - start; |
|
|
|