51 lines
1.3 KiB
Text
51 lines
1.3 KiB
Text
import "luxe: io" for IO
|
|
import "luxe: world" for World, Entity, Modifiers, ModifierSystem
|
|
|
|
//User facing API
|
|
//This is what the user of your modifier will interact with
|
|
class SpineRenderer {
|
|
|
|
static create(entity) { Modifiers.create(This, entity) }
|
|
static destroy(entity) { Modifiers.destroy(This, entity) }
|
|
static has(entity) { Modifiers.has(This, entity) }
|
|
|
|
} //SpineRenderer
|
|
|
|
//Your modifier system implementation.
|
|
//This speaks to the engine and your user facing API
|
|
//to do the actual work. You'll get notified when things change
|
|
//in the world and respond to them here.
|
|
class SpineRendererSystem is ModifierSystem {
|
|
|
|
construct new() {
|
|
//called when your system is first created.
|
|
}
|
|
|
|
init(world) {
|
|
_world = world
|
|
//called when your modifier is created in a world
|
|
}
|
|
|
|
destroy() {
|
|
//called when your modifier is removed from a world
|
|
}
|
|
|
|
attach(entity, data) {
|
|
//called when attached to an entity
|
|
}
|
|
|
|
detach(entity, data) {
|
|
//called when detached from an entity, like on destroy
|
|
}
|
|
|
|
tick(delta) {
|
|
//called usually once every frame.
|
|
//called when the world that this modifier lives in, is ticked
|
|
each {|entity, data|
|
|
//use data.*
|
|
}
|
|
} //tick
|
|
|
|
} //SpineRendererSystem
|
|
|
|
var Modifier = SpineRendererSystem //required
|