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