|
|
@ -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() |
|
|
|