rts-sim-module/entities/common_entity.go
2023-09-22 10:53:51 +08:00

23 lines
646 B
Go

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