27 lines
527 B
Go
27 lines
527 B
Go
package sys
|
|
|
|
import (
|
|
"joylink.club/ecs"
|
|
"joylink.club/ecs/filter"
|
|
"joylink.club/rtsssimulation/component"
|
|
)
|
|
|
|
// 世界世界更新系统
|
|
type WorldTimeSys struct {
|
|
query *ecs.Query
|
|
}
|
|
|
|
func NewWorldTimeSys() *WorldTimeSys {
|
|
return &WorldTimeSys{
|
|
query: ecs.NewQuery(filter.Contains(component.WorldDataType)),
|
|
}
|
|
}
|
|
|
|
func (s *WorldTimeSys) Update(w ecs.World) {
|
|
entry, _ := s.query.First(w)
|
|
data := component.WorldDataType.Get(entry)
|
|
data.Time += int64(w.Tick())
|
|
// t := time.UnixMilli(data.Time)
|
|
// fmt.Println(t)
|
|
}
|