diff --git a/component/signal.go b/component/signal.go index 23bd86e..a1b28f1 100644 --- a/component/signal.go +++ b/component/signal.go @@ -5,6 +5,10 @@ import ( "joylink.club/rtsssimulation/component/component_proto" ) +var SignalTag = ecs.NewTag() //标记一个实体为信号机 + +////////////////////////////////////////////////////////////////// + // SignalLights 信号机灯位列表 type SignalLights struct { Lights []*ecs.Entry diff --git a/entity/signal.go b/entity/signal.go index 22e41d5..92c1fa5 100644 --- a/entity/signal.go +++ b/entity/signal.go @@ -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 }