信号机实体添加SignalTag

This commit is contained in:
xzb 2023-10-20 09:46:49 +08:00
parent 4e26ee104f
commit 80bcb33db6
2 changed files with 5 additions and 1 deletions

View File

@ -5,6 +5,10 @@ import (
"joylink.club/rtsssimulation/component/component_proto"
)
var SignalTag = ecs.NewTag() //标记一个实体为信号机
//////////////////////////////////////////////////////////////////
// SignalLights 信号机灯位列表
type SignalLights struct {
Lights []*ecs.Entry

View File

@ -66,7 +66,7 @@ func LoadSignals(w ecs.World) error {
func newSignalEntity(w ecs.World, uid string, worldData *component.WorldData) *ecs.Entry {
entry, ok := worldData.EntityMap[uid]
if !ok {
entry = w.Entry(w.Create(component.UidType))
entry = w.Entry(w.Create(component.UidType, component.SignalTag))
component.UidType.SetValue(entry, component.Uid{Id: uid})
worldData.EntityMap[uid] = entry
}