Ejemplo n.º 1
0
        /// <summary>
        /// Adds an identifiable object to the active "scene." Please note that the object's
        /// identity may change based on which identities are available, and these new IDs are
        /// randomly generated.
        /// </summary>
        /// <param name="o">The object to add.</param>
        /// <returns>The IdentityNumber that the added object was registered with.</returns>
        public static IdentityNumber Add(Identifiable o)
        {
            IdentityNumber id = o.GetID();

            if (map.Has(id))
            {
                o.SetID(map.Random((Package)id.Package));
                id = o.GetID();
            }
            WriteLine("assigning to id " + id);
            map[id] = o;
            return(id);
        }