public RoutewayList HasRoutewayList(Architecture destination) { RoutewayList list = new RoutewayList(); foreach (Routeway routeway in this.Routeways) { if (routeway.DestinationArchitecture == destination) { list.Add(routeway); } } return list; }
public void LoadRoutewaysFromString(RoutewayList routeways, string dataString) { char[] separator = new char[] { ' ', '\n', '\r', '\t' }; string[] strArray = dataString.Split(separator, StringSplitOptions.RemoveEmptyEntries); this.Routeways.Clear(); foreach (string str in strArray) { Routeway gameObject = routeways.GetGameObject(int.Parse(str)) as Routeway; if (gameObject != null) { this.AddRouteway(gameObject); } } }
private void RoutewayAI() { if (GameObject.Random(10) == 0) { RoutewayList toRemove = new RoutewayList(); foreach (Routeway r in this.Routeways) { if (!r.IsInUsing) { toRemove.Add(r); } } foreach (Routeway r in toRemove) { this.RemoveRoutewayToArchitecture(r.DestinationArchitecture); } } }
public RoutewayList GetActiveRoutewayListByPosition(Point position) { RoutewayList list = new RoutewayList(); if (!this.PositionOutOfRange(position)) { if (this.MapTileData[position.X, position.Y].TileRouteways == null) { return list; } foreach (Routeway routeway in this.MapTileData[position.X, position.Y].TileRouteways) { if (routeway.IsActive || routeway.IsPointActive(position)) { list.Add(routeway); } } } return list; }