rts-sim-module/deprecated/entities/common_entity.go

23 lines
657 B
Go
Raw Normal View History

2023-09-13 10:05:42 +08:00
package entities
import (
"time"
"joylink.club/ecs"
"joylink.club/rtsssimulation/deprecated/system"
2023-09-13 10:05:42 +08:00
)
2023-09-15 13:50:15 +08:00
// CreateModelStorageEntity 创建模型仓库实体
2023-09-22 10:53:51 +08:00
func CreateModelStorageEntity(w ecs.World, modelManager system.IModelManager) *ecs.Entry {
2023-09-15 10:13:25 +08:00
e := w.Create(system.ModelStorageComponent)
system.ModelStorageComponent.Set(e, &system.ModelStorageRef{ModelManager: modelManager})
return e
2023-09-13 10:05:42 +08:00
}
2023-09-15 13:50:15 +08:00
// CreateSystemTimerEntity 创建系统时钟实体
2023-09-13 10:05:42 +08:00
func CreateSystemTimerEntity(w ecs.World, systemTime time.Time) *ecs.Entry {
e := w.Create(system.SystemTimerComponent)
system.SystemTimerComponent.Set(e, system.NewSystemTimer(&systemTime))
return e
}