Entity
The Entity, an abstract being, equipped with data.
Lifecycle
var world = World.Create(); // World must exist somewhere
// A dwarf with a string, position and velocity component was born and killed
var dwarf = world.Create(new Dwarf("Gimli"), new Position(0,0), new Velocity());
if(dwarf.IsAlive()) world.Destroy(dwarf);Change
// Create our beloved dwarf
var dwarf = world.Create(new Dwarf("Gimli"), new Position(0,0), new Velocity());
// Telepor the dwarf
ref var position = ref dwarf.Get<Position>();
position.X++;
position.Y++;
// Force him to move on its own
dwarf.Set(new Velocity(1,1));
// Give the dwarf a pickaxe and make him sad by taking it away
if(!dwarf.Has<Pickaxe>()) dwarf.Add(new Pickaxe());
dwarf.Remove<Pickaxe>();Reference
Inspect
Pitfalls
Last updated