rts-sim-module/entity/axle_counting_section.go

21 lines
608 B
Go
Raw Normal View History

package entity
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
)
var AxleCountingSectionBaseComponentTypes = []ecs.IComponentType{component.UidType, component.AxleCountingSectionStateType}
// LoadPhysicalSections 加载计轴区段
func LoadAxleCountingSections(w ecs.World) error {
wd := GetWorldData(w)
sections := wd.Repo.AxleCountingSectionList()
for _, section := range sections {
entry := w.Entry(w.Create(AxleCountingSectionBaseComponentTypes...))
component.UidType.SetValue(entry, component.Uid{Id: section.Id()})
wd.EntityMap[section.Id()] = entry
}
return nil
}