rts-sim-module/sys/world_time.go
2023-10-09 18:07:39 +08:00

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)
}