public void RemoveSupplyingRoutePoint(RoutePoint routePoint) { if (this.SupplyingRoutePoints != null) { this.SupplyingRoutePoints.Remove(routePoint); } }
public bool IsEnough(Point position, int food) { RoutePoint point = null; this.RouteArea.TryGetValue(position, out point); return((point != null) && this.IsEnough(point.ConsumptionRate, food)); }
public void Extend(Point p) { RoutePoint point = new RoutePoint(); point.Position = p; TerrainDetail terrainDetailByPosition = base.Scenario.GetTerrainDetailByPosition(p); if (this.RoutePoints.Count <= 0) { point.Index = 0; point.PreviousDirection = SimpleDirection.None; point.Direction = SimpleDirection.None; point.ConsumptionRate = terrainDetailByPosition.RoutewayConsumptionRate * this.BelongedFaction.RateOfRoutewayConsumption; point.BuildFundCost = (int)(terrainDetailByPosition.RoutewayBuildFundCost * this.StartArchitecture.RateOfRoutewayBuildFundCost); point.ActiveFundCost = terrainDetailByPosition.RoutewayActiveFundCost; point.BuildWorkCost = terrainDetailByPosition.RoutewayBuildWorkCost; } else { point.Index = this.LastPoint.Index + 1; int num = p.X - this.LastPoint.Position.X; int num2 = p.Y - this.LastPoint.Position.Y; switch (num) { case -1: this.LastPoint.Direction = SimpleDirection.Left; break; case 0: switch (num2) { case -1: this.LastPoint.Direction = SimpleDirection.Up; break; case 1: this.LastPoint.Direction = SimpleDirection.Down; break; } break; case 1: this.LastPoint.Direction = SimpleDirection.Right; break; } point.PreviousDirection = this.LastPoint.Direction; point.Direction = SimpleDirection.None; point.ConsumptionRate = this.LastPoint.ConsumptionRate + (terrainDetailByPosition.RoutewayConsumptionRate * this.BelongedFaction.RateOfRoutewayConsumption); point.BuildFundCost = this.LastPoint.BuildFundCost + ((int)(terrainDetailByPosition.RoutewayBuildFundCost * this.StartArchitecture.RateOfRoutewayBuildFundCost)); point.ActiveFundCost = this.LastPoint.ActiveFundCost + terrainDetailByPosition.RoutewayActiveFundCost; point.BuildWorkCost = terrainDetailByPosition.RoutewayBuildWorkCost; } point.BelongedRouteway = this; this.RoutePoints.AddLast(point); if (this.LastActivePointIndex >= point.Index) { this.BelongedFaction.AddPositionInformation(p, GlobalVariables.RoutewayInformationLevel); } base.Scenario.MapTileData[p.X, p.Y].AddTileRouteway(this); }
private void AddRoutePointArea(RoutePoint routePoint) { GameArea area = GameArea.GetViewArea(routePoint.Position, this.Radius, true, base.Scenario, this.BelongedFaction); foreach (Point point in area.Area) { if (!base.Scenario.PositionOutOfRange(point) && !this.RouteArea.ContainsKey(point)) { this.RouteArea.Add(point, routePoint); base.Scenario.MapTileData[point.X, point.Y].AddSupplyingRoutePoint(routePoint); } } }
public void AddSupplyingRoutePoint(RoutePoint routePoint) { if (this.SupplyingRoutePoints == null) { this.SupplyingRoutePoints = new List <RoutePoint>(); } if (this.SupplyingRoutePoints.IndexOf(routePoint) >= 0) { this.SupplyingRoutePoints.Remove(routePoint); } this.SupplyingRoutePoints.Add(routePoint); }
public void LoadRoutePointsFromString(string points) { char[] separator = new char[] { ' ', '\n', '\r', '\t' }; string[] strArray = points.Split(separator, StringSplitOptions.RemoveEmptyEntries); this.RoutePoints.Clear(); for (int i = 0; i < strArray.Length; i += 2) { RoutePoint point = new RoutePoint(); point.Position = new Point(int.Parse(strArray[i]), int.Parse(strArray[i + 1])); this.RoutePoints.AddLast(point); } }
private void RemoveRoutePointArea(RoutePoint routePoint) { GameArea area = GameArea.GetArea(routePoint.Position, this.Radius, true); foreach (Point point in area.Area) { RoutePoint point2 = null; this.RouteArea.TryGetValue(point, out point2); if (point2 == routePoint) { this.RouteArea.Remove(point); base.Scenario.MapTileData[point.X, point.Y].RemoveSupplyingRoutePoint(routePoint); } } }
public void ReGenerateRoutePointArea() { foreach (Point point in this.RouteArea.Keys) { RoutePoint point2 = null; this.RouteArea.TryGetValue(point, out point2); if (point2 != null) { base.Scenario.MapTileData[point.X, point.Y].RemoveSupplyingRoutePoint(point2); } } this.RouteArea.Clear(); foreach (RoutePoint point2 in this.RoutePoints) { if (point2.Index <= this.LastActivePointIndex) { this.AddRoutePointArea(point2); } } }
public void Extend(Point p) { RoutePoint point = new RoutePoint(); point.Position = p; TerrainDetail terrainDetailByPosition = base.Scenario.GetTerrainDetailByPosition(p); if (this.RoutePoints.Count <= 0) { point.Index = 0; point.PreviousDirection = SimpleDirection.None; point.Direction = SimpleDirection.None; point.ConsumptionRate = terrainDetailByPosition.RoutewayConsumptionRate * this.BelongedFaction.RateOfRoutewayConsumption; point.BuildFundCost = (int) (terrainDetailByPosition.RoutewayBuildFundCost * this.StartArchitecture.RateOfRoutewayBuildFundCost); point.ActiveFundCost = terrainDetailByPosition.RoutewayActiveFundCost; point.BuildWorkCost = terrainDetailByPosition.RoutewayBuildWorkCost; } else { point.Index = this.LastPoint.Index + 1; int num = p.X - this.LastPoint.Position.X; int num2 = p.Y - this.LastPoint.Position.Y; switch (num) { case -1: this.LastPoint.Direction = SimpleDirection.Left; break; case 0: switch (num2) { case -1: this.LastPoint.Direction = SimpleDirection.Up; break; case 1: this.LastPoint.Direction = SimpleDirection.Down; break; } break; case 1: this.LastPoint.Direction = SimpleDirection.Right; break; } point.PreviousDirection = this.LastPoint.Direction; point.Direction = SimpleDirection.None; point.ConsumptionRate = this.LastPoint.ConsumptionRate + (terrainDetailByPosition.RoutewayConsumptionRate * this.BelongedFaction.RateOfRoutewayConsumption); point.BuildFundCost = this.LastPoint.BuildFundCost + ((int) (terrainDetailByPosition.RoutewayBuildFundCost * this.StartArchitecture.RateOfRoutewayBuildFundCost)); point.ActiveFundCost = this.LastPoint.ActiveFundCost + terrainDetailByPosition.RoutewayActiveFundCost; point.BuildWorkCost = terrainDetailByPosition.RoutewayBuildWorkCost; } point.BelongedRouteway = this; this.RoutePoints.AddLast(point); if (this.LastActivePointIndex >= point.Index) { this.BelongedFaction.AddPositionInformation(p, GlobalVariables.RoutewayInformationLevel); } base.Scenario.MapTileData[p.X, p.Y].AddTileRouteway(this); }
public void AddSupplyingRoutePoint(RoutePoint routePoint) { if (this.SupplyingRoutePoints == null) { this.SupplyingRoutePoints = new List<RoutePoint>(); } if (this.SupplyingRoutePoints.IndexOf(routePoint) >= 0) { this.SupplyingRoutePoints.Remove(routePoint); } this.SupplyingRoutePoints.Add(routePoint); }