rts-sim-module/init.go

36 lines
747 B
Go
Raw Normal View History

package rtss_simulation
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/entity"
"joylink.club/rtsssimulation/modelrepo"
"joylink.club/rtsssimulation/repository"
"joylink.club/rtsssimulation/sys"
)
const (
// 仿真循环间隔单位ms
2024-08-05 16:32:20 +08:00
RtssSimulationTick = 10
)
// 初始化仿真
func NewSimulation(repo *repository.Repository) (ecs.World, error) {
w := ecs.NewWorld(RtssSimulationTick)
sys.BindSystem(w)
err := entity.Load(w, repo)
return w, err
}
// 加载城轨仿真
func LoadCgSimulation(repo modelrepo.Repo) (ecs.World, error) {
w := ecs.NewWorld(RtssSimulationTick)
// 加载组件实体
2023-12-29 17:48:57 +08:00
err := entity.Loading(w, repo)
if err != nil {
return nil, err
}
// 加载系统
sys.BindSystem(w)
return w, err
}