Esempio n. 1
0
        public Scene()
        {
            _GameObjectCache = new GameObjectCache(this);

            Enabled = false;
            Visible = false;

            Camera
            .Create(this);
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
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();
            }
        }
Esempio n. 4
0
 void OnDeserialized(StreamingContext c)
 {
     _GameObjectCache = new GameObjectCache(this);
     _World           = (World)Parent;
 }
Esempio n. 5
0
 /// <summary>
 /// Returns an entity with the given ID.
 /// </summary>
 public Entity GetObject(string id)
 {
     return(GameObjectCache.GetEntityById(id, Initialized));
 }
Esempio n. 6
0
 public override void OnChangeComponents()
 {
     GameObjectCache.CacheComponents();
     GameObjectCache.CacheObjectsToDraw();
 }
Esempio n. 7
0
        public override void OnInitialize(bool restore)
        {
            base.OnInitialize(restore);

            GameObjectCache.CacheAll();
        }