Exemple #1
0
        protected GameObject(Range <GameObjectID> in_bounds, GameObjectID in_id, string in_name, string in_description, string in_comment)
        {
            Precondition.IsInRange(in_id, in_bounds, nameof(in_id));
            Precondition.IsNotEmpty(in_name, nameof(in_name));

            ID          = in_id;
            Name        = in_name;
            Description = in_description ?? "";
            Comment     = in_comment ?? "";
        }
Exemple #2
0
        /// <summary>
        /// Returns the specified <typeparamref name="T"/>.
        /// </summary>
        /// <param name="in_id">A valid, defined <typeparamref name="T"/> identifier.</param>
        /// <typeparam name="T">
        /// The type of <typeparamref name="ParentType"/> sought.  Must correspond to the given <paramref name="in_id"/>.
        /// </typeparam>
        /// <returns>The specified <typeparamref name="T"/>.</returns>
        public T Get <T>(GameObjectID in_id) where T : ParentType
        {
            Precondition.IsInRange(in_id, Bounds, nameof(in_id));

            return((T)Entities[in_id]);
        }
Exemple #3
0
        /// <summary>
        /// Determines whether the <see cref="GameObjectCollection{T}"/> contains the specified <see cref="GameObject"/>.
        /// </summary>
        /// <param name="in_id">The <see cref="GameObjectID"/> of the <see cref="GameObject"/> to find.</param>
        /// <returns><c>true</c> if the <see cref="GameObjectID"/> was found; <c>false</c> otherwise.</returns>
        /// <remarks>This method is equivalent to <see cref="Dictionary{EntityID, Entity}.ContainsKey"/>.</remarks>
        public bool Contains(GameObjectID in_id)
        {
            Precondition.IsInRange(in_id, Bounds, nameof(in_id));

            return(Entities.ContainsKey(in_id));
        }