rts-sim-module/entities/common_entity.go
2023-09-15 13:07:31 +08:00

24 lines
629 B
Go

package entities
import (
"time"
"joylink.club/ecs"
"joylink.club/rtsssimulation/system"
"joylink.club/rtsssimulation/umi"
)
// 创建模型仓库实体
func CreateModelStorageEntity(w ecs.World, modelManager umi.IModelManager) *ecs.Entry {
e := w.Create(system.ModelStorageComponent)
system.ModelStorageComponent.Set(e, &system.ModelStorageRef{ModelManager: modelManager})
return e
}
// 创建系统时钟实体
func CreateSystemTimerEntity(w ecs.World, systemTime time.Time) *ecs.Entry {
e := w.Create(system.SystemTimerComponent)
system.SystemTimerComponent.Set(e, system.NewSystemTimer(&systemTime))
return e
}