Example #1
0
 /// <see cref="IScenarioLoaderPluginInstall.RegisterPlacementSuggestionProvider"/>
 public void RegisterPlacementSuggestionProvider(string buildingType, BuildingPlacementSuggestionProvider provider)
 {
     if (buildingType == null)
     {
         throw new ArgumentNullException("buildingType");
     }
     if (!this.suggestionProviders.ContainsKey(buildingType))
     {
         this.suggestionProviders.Add(buildingType, new List <BuildingPlacementSuggestionProvider>());
     }
     this.suggestionProviders[buildingType].Add(provider);
 }
Example #2
0
        /// <summary>
        /// Adds a placement suggestion provider to this building type.
        /// </summary>
        /// <param name="suggestionProvider">The placement suggestion provider to add.</param>
        public void AddPlacementSuggestionProvider(BuildingPlacementSuggestionProvider suggestionProvider)
        {
            if (this.Metadata.IsFinalized)
            {
                throw new InvalidOperationException("Already finalized!");
            }
            if (suggestionProvider == null)
            {
                throw new ArgumentNullException("suggestionProvider");
            }

            suggestionProvider.SetBuildingType(new IBuildingType(this));
            this.suggestionProviders.Add(suggestionProvider);
        }