// Define an archetype for a player entity with multiple components
const playerArchetype: Archetype = {
components: [
new Transform({position: new Vector2(0, 0)}),
new Player({health: 100}),
new SpriteRenderer({sprite: 'player.png'})
],
};
// Define an archetype with disabled components and child entities
const enemyArchetype: Archetype = {
components: [
new Transform(),
new Enemy(),
disableComponent(new BoxCollider()) // This component starts disabled
],
children: [
{
components: [new WeaponMount()],
enabled: false // This child entity starts disabled
}
],
};
This type represents an Entity Archetype, which defines a template for creating entities with a specific set of components.
It specifies which components should be attached to the entity, whether the entity should be enabled/disabled,
and can include child archetypes to create hierarchical entity structures.