Beispiel #1
0
        /// <summary>
        /// Build the data provider for setting up a behavior for the entity. The entity can control which parameters
        /// and behaviors are visible to behaviors using this method.
        /// </summary>
        /// <param name="parameters">The parameters in the simulation.</param>
        /// <param name="behaviors">The behaviors in the simulation.</param>
        /// <returns>A data provider for the behaviors.</returns>
        /// <exception cref="ArgumentNullException">
        /// parameters
        /// or
        /// behaviors
        /// </exception>
        protected virtual SetupDataProvider BuildSetupDataProvider(ParameterPool parameters, BehaviorPool behaviors)
        {
            parameters.ThrowIfNull(nameof(parameters));
            behaviors.ThrowIfNull(nameof(behaviors));

            // By default, we include the parameters of this entity
            var result = new SetupDataProvider();

            result.Add("entity", parameters[Name]);
            result.Add("entity", behaviors[Name]);
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Build the data provider for setting up a behavior for the entity. The entity can control which parameters
        /// and behaviors are visible to behaviors using this method.
        /// </summary>
        /// <param name="parameters">The parameters in the simulation.</param>
        /// <param name="behaviors">The behaviors in the simulation.</param>
        /// <returns>A data provider for the behaviors.</returns>
        /// <exception cref="ArgumentNullException">
        /// parameters
        /// or
        /// behaviors
        /// </exception>
        protected virtual SetupDataProvider BuildSetupDataProvider(ParameterPool parameters, BehaviorPool behaviors)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }
            if (behaviors == null)
            {
                throw new ArgumentNullException(nameof(behaviors));
            }

            // By default, we include the parameters of this entity
            var result = new SetupDataProvider();

            result.Add("entity", parameters[Name]);
            result.Add("entity", behaviors[Name]);
            return(result);
        }