/// <see cref="ObjectPlacementView.CheckObjectConstraints"/> protected override RCSet <RCIntVector> CheckObjectConstraints(RCIntVector topLeftQuadCoords) { RCSet <RCIntVector> violatingQuadCoords = this.terrainObjectType.CheckConstraints(this.Map, topLeftQuadCoords); violatingQuadCoords.UnionWith(this.terrainObjectType.CheckTerrainObjectIntersections(this.Map, topLeftQuadCoords)); return(violatingQuadCoords); }
/// <see cref="IFogOfWarBC.GetAllMapObjectsToUpdate"/> public IEnumerable <MapObject> GetAllMapObjectsToUpdate() { if (this.ActiveScenario == null) { throw new InvalidOperationException("No active scenario!"); } this.UpdateQuadTileWindow(); RCSet <MapObject> allMapObjects = new RCSet <MapObject>(this.cache.Value.GroundMapObjectsToUpdate); allMapObjects.UnionWith(this.cache.Value.AirMapObjectsToUpdate); return(allMapObjects); }
/// <summary> /// Gets the map objects inside the given area of the given layers. /// </summary> /// <param name="area">The area to search.</param> /// <param name="firstLayer">The first layer to search in.</param> /// <param name="furtherLayers">List of the further layers to search in.</param> /// <returns>A list that contains the map objects inside the given area of the given layers.</returns> public RCSet <MapObject> GetMapObjects(RCNumRectangle area, MapObjectLayerEnum firstLayer, params MapObjectLayerEnum[] furtherLayers) { if (area == RCNumRectangle.Undefined) { throw new ArgumentNullException("area"); } if (furtherLayers == null) { throw new ArgumentNullException("furtherLayers"); } RCSet <MapObject> retList = this.mapObjects[firstLayer].GetContents(area); foreach (MapObjectLayerEnum furtherLayer in furtherLayers) { retList.UnionWith(this.mapObjects[furtherLayer].GetContents(area)); } return(retList); }
/// <see cref="IBuildingTypeInternal.GetPlacementSuggestions"/> public RCSet <Tuple <RCIntRectangle, RCIntVector> > GetPlacementSuggestions(Scenario scenario, RCIntRectangle area) { if (scenario == null) { throw new ArgumentNullException("scenario"); } if (area == RCIntRectangle.Undefined) { throw new ArgumentNullException("area"); } /// Get suggestions from the providers defined by this building type. RCSet <Tuple <RCIntRectangle, RCIntVector> > retList = new RCSet <Tuple <RCIntRectangle, RCIntVector> >(); foreach (BuildingPlacementSuggestionProvider suggestionProvider in this.suggestionProviders) { retList.UnionWith(suggestionProvider.GetSuggestions(scenario, area)); } return(retList); }
/// <see cref="ITerrainObjectType.CheckConstraints"/> public RCSet <RCIntVector> CheckConstraints(IMapAccess map, RCIntVector position) { if (map == null) { throw new ArgumentNullException("map"); } if (position == RCIntVector.Undefined) { throw new ArgumentNullException("position"); } /// Check against the constraints defined by this terrain object type. RCSet <RCIntVector> retList = new RCSet <RCIntVector>(); foreach (ITerrainObjectConstraint contraint in this.constraints) { retList.UnionWith(contraint.Check(map, position)); } for (int quadX = 0; quadX < this.quadraticSize.X; quadX++) { for (int quadY = 0; quadY < this.quadraticSize.Y; quadY++) { RCIntVector relQuadCoords = new RCIntVector(quadX, quadY); RCIntVector absQuadCoords = position + relQuadCoords; if (absQuadCoords.X < 0 || absQuadCoords.X >= map.Size.X || absQuadCoords.Y < 0 || absQuadCoords.Y >= map.Size.Y) { /// Intersection with the boundaries of the map. retList.Add(relQuadCoords); } } } return(retList); }
/// <see cref="IScenarioElementTypeInternal.CheckPlacementConstraints"/> public RCSet <RCIntVector> CheckPlacementConstraints(Scenario scenario, RCIntVector position, RCSet <Entity> entitiesToIgnore) { if (scenario == null) { throw new ArgumentNullException("scenario"); } if (position == RCIntVector.Undefined) { throw new ArgumentNullException("position"); } /// Check against the constraints defined by this scenario element type. RCSet <RCIntVector> retList = new RCSet <RCIntVector>(); foreach (EntityPlacementConstraint constraint in this.placementConstraints) { retList.UnionWith(constraint.Check(scenario, position, entitiesToIgnore)); } /// Check against map boundaries. this.CheckMapBorderIntersections(scenario, position, ref retList); return(retList); }