Browse Source

Random Districts Part 3

master
laurids 2 years ago
parent
commit
3382804efd
7 changed files with 64 additions and 2 deletions
  1. +2
    -1
      Assets/GWConquest/Scenes/GalaxyMap.unity
  2. +24
    -0
      Assets/GWConquest/Scripts/District.cs
  3. +20
    -0
      Assets/GWConquest/Scripts/PlanetPlacement.cs
  4. BIN
      Assets/Photon/PhotonBolt/assemblies/bolt.user.dll
  5. BIN
      Assets/Photon/PhotonBolt/assemblies/bolt.user.dll.mdb
  6. +17
    -0
      Assets/Photon/PhotonBolt/project.json
  7. +1
    -1
      Assets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset

+ 2
- 1
Assets/GWConquest/Scenes/GalaxyMap.unity View File

@ -83735,7 +83735,8 @@ MonoBehaviour:
MinDistricts: 1
FactoryChance: 0.3
FoodChance: 0.3
MaxDistrictRadius: 0.5
MaxDistrictRadius: 0.3
ConnectionChance: 0.5
AvailableNames: []
--- !u!4 &1422402912
Transform:


+ 24
- 0
Assets/GWConquest/Scripts/District.cs View File

@ -9,6 +9,7 @@ namespace GWConquest
public class District : GWBoltBehaviour<IDistrictState>
{
public static List<District> AllDistricts = new List<District>();
public static List<DistrictConnection> AllConnections = new List<DistrictConnection>();
public bool DistrictStatic;
@ -18,6 +19,8 @@ namespace GWConquest
public DistrictType DistrictType = DistrictType.Civil;
public int DistrictLevel;
public EntityList ConnectionList;
private Zone _zone;
public Zone Zone {
get {
@ -77,6 +80,8 @@ namespace GWConquest
public override void Attached()
{
ConnectionList = new EntityList(State, "ConnectedDistricts");
if(entity.IsOwner)
{
StorageCapacity = GameManager.Instance.DefaultStorageCapacity;
@ -135,6 +140,25 @@ namespace GWConquest
transform.localPosition = State.RelativePosition;
gameObject.name = DistrictName;
}
InitConnections();
}
public void InitConnections()
{
foreach(var ent in ConnectionList)
{
var otherDistrict = ent.Entity.GetComponent<District>();
if(!AllConnections.Exists(c => c.district1 == this && c.district2 == otherDistrict || c.district2 == this && c.district1 == otherDistrict))
{
var go = new GameObject("District Connection");
var conn = go.AddComponent<DistrictConnection>();
conn.district1 = this;
conn.district2 = otherDistrict;
go.transform.SetParent(Planet.transform);
AllConnections.Add(conn);
}
}
}
public virtual Sprite GetCurrentSprite()


+ 20
- 0
Assets/GWConquest/Scripts/PlanetPlacement.cs View File

@ -97,6 +97,8 @@ namespace GWConquest
public float FoodChance;
public float MaxDistrictRadius;
public float ConnectionChance;
}
public DistrictSettings districtSettings = new DistrictSettings();
@ -251,6 +253,24 @@ namespace GWConquest
nextZoneId++;
district.Planet = planet;
var otherDistricts = planet.GetComponentsInChildren<District>().ToList();
while(otherDistricts.Count > 0)
{
var otherDistrict = otherDistricts[0];
district.ConnectionList.Add(otherDistrict.entity);
otherDistrict.ConnectionList.Add(district.entity);
otherDistricts.RemoveAt(0);
if(Random.value > districtSettings.ConnectionChance)
{
break;
}
}
district.InitNonStatic();
}


BIN
Assets/Photon/PhotonBolt/assemblies/bolt.user.dll View File


BIN
Assets/Photon/PhotonBolt/assemblies/bolt.user.dll.mdb View File


+ 17
- 0
Assets/Photon/PhotonBolt/project.json View File

@ -2430,6 +2430,23 @@
"ExtrapolationMaxFrames": 9,
"SnapMagnitude": 10.0
}
},
{
"Name": "ConnectedDistricts",
"Enabled": true,
"Expanded": true,
"ReplicationMode": 1,
"Priority": 1,
"PropertyType": {
"$type": "Photon.Bolt.Compiler.PropertyTypeProtocolToken, bolt.compiler"
},
"AssetSettings": {
"$type": "Photon.Bolt.Compiler.PropertyStateSettings, bolt.compiler",
"ExtrapolationErrorTolerance": 0.25,
"_ExtrapolationCorrectionFrames": 6,
"ExtrapolationMaxFrames": 9,
"SnapMagnitude": 10.0
}
}
],
"PacketMaxBits": 512,


+ 1
- 1
Assets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset View File

@ -53,7 +53,7 @@ MonoBehaviour:
debugPlayAsServer: 0
showDebugInfo: 0
overrideTimeScale: 1
debugEditorMode: 1
debugEditorMode: 2
consoleToggleKey: 9
consoleVisibleByDefault: 0
compilationWarnLevel: 4


Loading…
Cancel
Save