world.go
func (w *World) AddEntity(e Identifier) {
	if w.sysIn == nil {
		w.sysIn = make(map[reflect.Type]reflect.Type)
	}
	if w.sysEx == nil {
		w.sysEx = make(map[reflect.Type]reflect.Type)
	}
	for _, system := range w.systems {
		sys, ok := system.(SystemAddByInterfacer)
		if !ok {
			continue
		}
		if ex, not := w.sysEx[reflect.TypeOf(sys)]; not {
			if reflect.TypeOf(e).Implements(ex) {
				continue
			}
		}
		if in, ok := w.sysIn[reflect.TypeOf(sys)]; ok {
			if reflect.TypeOf(e).Implements(in) {
				sys.AddByInterface(e)
			}
		}
	}
}
func (w *World) AddEntity(e Identifier) {
	if w.sysIn == nil {
		w.sysIn = make(map[reflect.Type]reflect.Type)
	}
	if w.sysEx == nil {
		w.sysEx = make(map[reflect.Type]reflect.Type)
	}
	for _, system := range w.systems {
		sys, ok := system.(SystemAddByInterfacer)
		if !ok {
			continue
		}
		if ex, not := w.sysEx[reflect.TypeOf(sys)]; not {
			if reflect.TypeOf(e).Implements(ex) {
				continue
			}
		}
		if in, ok := w.sysIn[reflect.TypeOf(sys)]; ok {
			if reflect.TypeOf(e).Implements(in) {
				sys.AddByInterface(e)
			}
		}
	}
}
func ( w * World ) AddEntity ( e Identifier ) { if w . sysIn == nil { w . sysIn = make ( map [ reflect . Type ] reflect . Type ) } if w . sysEx == nil { w . sysEx = make ( map [ reflect . Type ] reflect . Type ) } for _ , system := range w . systems { sys , ok := system . ( SystemAddByInterfacer ) if ! ok { continue } if ex , not := w . sysEx [ reflect . TypeOf ( sys ) ] ; not { if reflect . TypeOf ( e ) . Implements ( ex ) { continue } } if in , ok := w . sysIn [ reflect . TypeOf ( sys ) ] ; ok { if reflect . TypeOf ( e ) . Implements ( in ) { sys . AddByInterface ( e ) } } } }
// AddEntity adds the entity to all systems that have been added via
// AddSystemInterface. If the system was added via AddSystem the entity will not be
// added to it.
AddEntity adds the entity to all systems that have been added via AddSystemInterface . If the system was added via AddSystem the entity will not be added to it .