public virtual void AddEntity(Entity entity)
 {
     //Subscribe to the destory event
     entity.DestroyEvent += RemoveEntity;
     entity.CreateEvent += AddEntity;
     NewEntities.Add(entity);
     if (EntityAdded != null)
         EntityAdded(entity);
 }
Beispiel #2
0
 public virtual void Destroy(Entity e = null)
 {
     if (DestroyEvent != null)
         DestroyEvent(this);
     foreach (var component in Components.ToList())
     {
         component.Destroy();
     }
 }
Beispiel #3
0
 public Emitter(Entity e, Texture2D texture, Vector2 tilesize)
     : base(e)
 {
     Texture = texture;
     TileSize = tilesize;
 }
 public virtual void RemoveEntity(Entity entity)
 {
     //Unsubscribe from the destroy event
     NewEntities.Remove(entity);
     if (EntityRemoved != null)
         EntityRemoved(entity);
 }
 public TextRender(Entity e, SpriteFont sf, string text, Vector2 position)
 {
     Entity = e;
     Text = text;
     Font = sf;
 }
Beispiel #6
0
 public Weapon(Entity e)
     : base(e)
 {
 }
Beispiel #7
0
 public Gun(Entity e, Texture2D bullettexture)
     : base(e)
 {
     BulletTexture = bullettexture;
 }
Beispiel #8
0
 public virtual void AddEntity(Entity e)
 {
     if (CreateEvent != null)
         CreateEvent(e);
 }