rts-sim-module/entity/iscs_acs.go
2023-12-15 17:30:15 +08:00

19 lines
416 B
Go

package entity
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
)
// NewDoorSensorEntity 创建门磁实体
func NewDoorSensorEntity(w ecs.World, id string) *ecs.Entry {
wd := GetWorldData(w)
e, ok := wd.EntityMap[id]
if !ok {
e := w.Entry(w.Create(component.UidType, component.DoorSensorType))
component.UidType.SetValue(e, component.Uid{Id: id})
wd.EntityMap[id] = e
}
return e
}