rts-sim-module/simulation/init.go

22 lines
493 B
Go
Raw Normal View History

2023-09-13 10:05:42 +08:00
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)
}
2023-09-15 10:13:25 +08:00
// 创建world时间实体
2023-09-13 10:05:42 +08:00
entities.CreateSystemTimerEntity(world, config.InitTime)
2023-09-15 10:13:25 +08:00
// 创建world模型仓库实体
entities.CreateModelStorageEntity(world, config.ModelManager)
2023-09-13 10:05:42 +08:00
//
return world
}