예제 #1
0
        /// <summary>
        /// Unloads and removes the given GameObject.
        /// </summary>
        public void Pop(Entity gameObject)
        {
            gameObject.OnUnloadContent();
            Items.Remove(gameObject);

            if (Initialized)
            {
                GameObjectCache.CacheAll();
            }

            if (null != World)
            {
                World.InvalidateEntityIDCache(gameObject);
            }
        }
예제 #2
0
        /// <summary>
        /// Pushes an Entity onto this scene.
        /// </summary>
        public void Push(Entity entity)
        {
            Items.Add(entity);

            entity.UpdateScene = this;
            entity.DrawScene   = entity.DrawScene ?? this;

            if (Loaded)
            {
                entity.OnLoadContent(this.Content);
            }

            if (Initialized)
            {
                GameObjectCache.CacheAll();
            }
        }
예제 #3
0
        public override void OnInitialize(bool restore)
        {
            base.OnInitialize(restore);

            GameObjectCache.CacheAll();
        }