public List<EntityInfo> NearestEntities(Entity sender, float distance) { var entities = (from entity in _worldManager.EntityList let d = Utils.GetDistance((Vector2) sender.GetCustomData()["faceposition"], sender.Body.Position) where d <= distance select entity).ToList(); return entities.Select(GetEntityInfo).ToList(); }
public EntityInfo GetEntityInfo(Entity target) { return new EntityInfo { Name = target.GetName(), Position = target.Body.Position, Rotation = target.Body.Rotation, Size = target.Size, Speed = target.GetSpeed(), AverageColor = target.CurrentSprite.AverageColor }; }
public void Kill(Entity sender) { _worldManager.Remove(sender); }