Entity Component System framework for Ebiten
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
850 B

package gohan
// Context represents the current iteration of a System's matching entities. It
// provides methods for retrieving components for the currently matched Entity,
// and removing the currently matched Entity.
type Context struct {
Entity Entity
allowed []ComponentID
components []interface{}
systemIndex int
world *World
}
// Component gets a Component of the currently handled Entity.
func (ctx *Context) Component(componentID ComponentID) interface{} {
return ctx.components[componentID]
}
// RemoveEntity removes the currently handled Entity's components, causing it
// to no longer be handled by any system. Because Gohan reuses removed Entity
// IDs, applications must also remove any other references to the removed Entity.
func (ctx *Context) RemoveEntity() bool {
return ctx.world.RemoveEntity(ctx.Entity)
}