Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameComponent"/> class, while adding it to the component manager.
        /// </summary>
        /// <param name="createNew">if set to <c>true</c> adds this component to the manager..</param>
        /// <param name="manager">The component manager to add the component to</param>
        public GameComponent(bool createNew, ComponentManager manager)
        {
            World = manager.World;
            lock (globalIdLock)
            {
                GlobalID = maxGlobalID;
                maxGlobalID++;
            }

            Parent   = null;
            Children = new List <GameComponent>();

            Name      = "uninitialized";
            IsVisible = true;
            IsActive  = true;
            IsDead    = false;

            if (createNew && Manager != null)
            {
                Manager.AddComponent(this);
            }

            Tags         = new List <string>();
            HasOwnRender = GameObjectCaching.HasOwnRender(this.GetType());
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GameComponent"/> class.
 /// </summary>
 public GameComponent()
 {
     World        = null;
     Children     = new List <GameComponent>();
     Name         = "uninitialized";
     IsVisible    = true;
     IsActive     = true;
     Tags         = new List <string>();
     HasOwnRender = GameObjectCaching.HasOwnRender(this.GetType());
 }