mirror of
https://github.com/bloeys/nmage.git
synced 2025-12-29 13:28:20 +00:00
Add BaseComp
This commit is contained in:
@ -1,9 +1,25 @@
|
||||
package entity
|
||||
|
||||
type Comp interface {
|
||||
// This ensures that implementors of the Comp interface
|
||||
// always embed BaseComp
|
||||
base()
|
||||
|
||||
Name() string
|
||||
}
|
||||
|
||||
var _ Comp = &BaseComp{}
|
||||
|
||||
type BaseComp struct {
|
||||
}
|
||||
|
||||
func (b *BaseComp) base() {
|
||||
}
|
||||
|
||||
func (b *BaseComp) Name() string {
|
||||
return "Base Component"
|
||||
}
|
||||
|
||||
func AddComp(e *Entity, c Comp) {
|
||||
e.Comps = append(e.Comps, c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user