Ejemplo n.º 1
0
        public void addEntity(DrawableEntity entity, bool addAsFirst = false, bool doInit = true)
        {
            if(addAsFirst)
                _entities.Insert(0, entity);
            else
                _entities.Add(entity);

            entity.setScreen(this);

            if(doInit)
                entity.initialize();
        }
Ejemplo n.º 2
0
        public GameScreen(GameManager gameManager)
            : base(gameManager, "Game")
        {
            _pickups            = new List<Pickup>(32);
            _hearts             = new List<Heart>();
            _leaves             = new List<Leaf>(32);
            _foodSources        = new List<Food>(32);

            _seedCursor         = new DrawableEntity(gameManager, this, "Textures/placement_cursor");
            _timeBetweenPulses  = Config.settings["Heart.TimeBetweenPulses"];
            _lastPulseTime      = 0;

            _seedCursor.setScale(0.25f);
            _seedCursor.setColor(Color.DarkSlateGray);

            addFood(new Food(_gameManager, this, new Vector2(256, 256), 16));
        }
Ejemplo n.º 3
0
 public virtual void removeEntity(DrawableEntity entity)
 {
     _entities.Remove(entity);
 }
Ejemplo n.º 4
0
 public void resolveCollision(DrawableEntity collider)
 {
     if (collider is Leaf)
         startBeingConsumed((Leaf)collider);
 }
Ejemplo n.º 5
0
        public override void removeEntity(DrawableEntity entity)
        {
            base.removeEntity(entity);

            if(entity is Leaf)
                _leaves.Remove((Leaf)entity);
            if(entity is Heart)
                _hearts.Remove((Heart)entity);
            if(entity is Pickup)
                _pickups.Remove((Pickup)entity);
        }