Provides a pretty-looking way to create and modify entities.
Example usage:
using static GameComponentsLookup;
// public class [...]
var binding = new EntityBinding<GameEntity>(this.gameContext) {
// using a statically imported integer index
[Name] = "Mr. Entity",
// anonymous types are correctly mapped to component classes by field name
[Color] = new { red = 150/255f, green = 123/255f, blue = 182/255f }
[Position] = new {x = 100, y = 25},
// literal values map to components with one field
[FacingDirection] = FacingDirection.Right
};
// you can use the indexer even after initialization
binding[Scale] = new { width = 1.5f, height = 0.5f };
// or access a component by name rather than by integer index
var name = (NameComponent)binding["Name"];
var entity = this.gameContext.GetEntityWithName(name.value);
Debug.Assert(object.ReferenceEquals(binding.entity, entity));
Credit for parts of this source code, and all of Entitas, goes to DesperateDevs.