You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
498 B
Go
30 lines
498 B
Go
4 years ago
|
package sim
|
||
|
|
||
4 years ago
|
import (
|
||
|
"time"
|
||
4 years ago
|
|
||
|
"github.com/jordanorelli/astro-domu/internal/wire"
|
||
4 years ago
|
)
|
||
4 years ago
|
|
||
4 years ago
|
type Entity struct {
|
||
|
ID int `json:"id"`
|
||
|
Position [2]int `json:"pos"`
|
||
|
Glyph rune `json:"glyph"`
|
||
|
behavior
|
||
|
}
|
||
4 years ago
|
|
||
4 years ago
|
func (Entity) NetTag() string { return "entity" }
|
||
|
|
||
|
func init() {
|
||
|
wire.Register(func() wire.Value { return new(Entity) })
|
||
|
}
|
||
|
|
||
4 years ago
|
type behavior interface {
|
||
4 years ago
|
// update is the standard tick function
|
||
|
update(time.Duration)
|
||
|
}
|
||
4 years ago
|
|
||
|
type doNothing struct{}
|
||
|
|
||
|
func (d doNothing) update(time.Duration) {}
|