github.com/15mga/kiwi@v0.0.2-0.20240324021231-b95d5c3ac751/ecs/component.go (about) 1 package ecs 2 3 func NewComponent(t TComponent) Component { 4 c := Component{ 5 typ: t, 6 } 7 return c 8 } 9 10 type Component struct { 11 typ TComponent 12 entity *Entity 13 } 14 15 func (c *Component) Type() TComponent { 16 return c.typ 17 } 18 19 func (c *Component) Init() { 20 21 } 22 23 func (c *Component) Start() { 24 } 25 26 func (c *Component) Dispose() { 27 } 28 29 func (c *Component) Entity() *Entity { 30 return c.entity 31 } 32 33 func (c *Component) setEntity(entity *Entity) { 34 c.entity = entity 35 }