Add Init,Update,Destroy to Comp+HasComp,DestroyComp funcs

This commit is contained in:
bloeys
2022-12-06 06:07:49 +04:00
parent 84cd8c28c8
commit b025afe1b4
6 changed files with 73 additions and 30 deletions

27
entity/base_comp.go Executable file
View File

@ -0,0 +1,27 @@
package entity
import "github.com/bloeys/nmage/assert"
var _ Comp = &BaseComp{}
type BaseComp struct {
Entity *Entity
}
func (b *BaseComp) base() {
}
func (b *BaseComp) Init(parent *Entity) {
assert.T(parent != nil, "Component was initialized with a nil parent. That is not allowed.")
b.Entity = parent
}
func (b *BaseComp) Name() string {
return "Base Component"
}
func (b *BaseComp) Update() {
}
func (b *BaseComp) Destroy() {
}