Example #1
0
        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();
        }
Example #2
0
 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
     };
 }
Example #3
0
 public void Kill(Entity sender)
 {
     _worldManager.Remove(sender);
 }