Example #1
0
 /// <see cref="IScenarioLoaderPluginInstall.RegisterEntityConstraint"/>
 public void RegisterEntityConstraint(string entityType, EntityPlacementConstraint constraint)
 {
     if (entityType == null)
     {
         throw new ArgumentNullException("entityType");
     }
     if (!this.entityConstraints.ContainsKey(entityType))
     {
         this.entityConstraints.Add(entityType, new List <EntityPlacementConstraint>());
     }
     this.entityConstraints[entityType].Add(constraint);
 }
Example #2
0
        /// <summary>
        /// Adds a placement constraint to this element type.
        /// </summary>
        /// <param name="constraints">The placement constraint to add.</param>
        public void AddPlacementConstraint(EntityPlacementConstraint constraint)
        {
            if (this.metadata.IsFinalized)
            {
                throw new InvalidOperationException("Already finalized!");
            }
            if (constraint == null)
            {
                throw new ArgumentNullException("constraint");
            }

            constraint.SetEntityType(new IScenarioElementType(this));
            this.placementConstraints.Add(constraint);
        }