rts-sim-module/simulation/init.go
2023-09-15 10:13:25 +08:00

22 lines
493 B
Go

package simulation
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/entities"
)
// 初始化仿真world
func InitializeWorld(config *WorldConfig) ecs.World {
world := ecs.NewWorld(config.Tick)
// 初始化系统
for _, sys := range config.Systems {
world.AddSystem(sys)
}
// 创建world时间实体
entities.CreateSystemTimerEntity(world, config.InitTime)
// 创建world模型仓库实体
entities.CreateModelStorageEntity(world, config.ModelManager)
//
return world
}