20 lines
394 B
Go
20 lines
394 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)
|
||
|
}
|
||
|
// 初始化系统时间
|
||
|
entities.CreateSystemTimerEntity(world, config.InitTime)
|
||
|
//
|
||
|
return world
|
||
|
}
|