public override void Update(GameTime gameTime, Levels.Level level)
        {
            if (Health == null)
            {
                Health = level.GetEntities <Poltergeist>().Select(p => p.Health).FirstOrDefault() ?? new Container(7);
            }

            base.Update(gameTime, level);
        }
        public override void Hit(Entity attacker, GameTime gameTime, Levels.Level level, Vector2 direction)
        {
            var oldHealth = Health.Quantity;

            base.Hit(attacker, gameTime, level, direction);

            if (level.GetEntities <Poltergeist>().Any())
            {
                Health.Quantity = oldHealth;
            }
        }
        public override bool IsActive(Microsoft.Xna.Framework.GameTime gameTime, Levels.Level level)
        {
            if (Entity.IsDead)
            {
                return(false);
            }

            if (Following != null)
            {
                if (MaxDistance != null)
                {
                    var distance = new Vector2(Following.CenterPosition.X - Entity.CenterPosition.X, Following.CenterPosition.Y - Entity.CenterPosition.Y).Length();
                    if (distance > MaxDistance)
                    {
                        Following.GetBehavior <ChainBehavior <T> >().FollowedBy = null;
                        Following = null;
                    }
                }

                if (Following != null && (Following.IsDead || !level.ContainsEntity(Following)))
                {
                    Following.GetBehavior <ChainBehavior <T> >().FollowedBy = null;
                    Following = null;
                }
            }

            if (Following == null)
            {
                Following = (from ent in level.GetEntities <T>()
                             where ent != Entity && !ent.IsDead && level.ContainsEntity(ent)
                             let beh = ent.GetBehavior <ChainBehavior <T> >()
                                       where beh != null && beh.FollowedBy == null && !beh.IsFollowingEntity(Entity)
                                       let pos = new Vector2(Entity.CenterPosition.X - ent.CenterPosition.X,
                                                             Entity.CenterPosition.Y - ent.CenterPosition.Y)
                                                 let distance = pos.Length()
                                                                where MaxDistance == null || distance < MaxDistance
                                                                orderby distance
                                                                select ent).FirstOrDefault();
                if (Following != null)
                {
                    Following.GetBehavior <ChainBehavior <T> >().FollowedBy = Entity;
                }
            }

            return(Following != null);
        }