24 lines
591 B
Go
24 lines
591 B
Go
package simulation
|
|
|
|
import (
|
|
"joylink.club/ecs"
|
|
"joylink.club/rtsssimulation/entities"
|
|
"joylink.club/rtsssimulation/system"
|
|
)
|
|
|
|
// InitializeWorld 初始化仿真world
|
|
func InitializeWorld(config *WorldConfig) ecs.World {
|
|
world := ecs.NewWorld(config.Tick)
|
|
// 添加系统
|
|
world.AddSystem(system.NewTimerSystem())
|
|
world.AddSystem(system.NewMovableSystem())
|
|
for _, sys := range config.Systems {
|
|
world.AddSystem(sys)
|
|
}
|
|
// 添加内置实体
|
|
entities.CreateSystemTimerEntity(world, config.InitTime)
|
|
entities.CreateModelStorageEntity(world, config.ModelManager)
|
|
//
|
|
return world
|
|
}
|