rts-sim-module/entity/iscs_acs.go

19 lines
416 B
Go
Raw Normal View History

2023-12-15 17:30:15 +08:00
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
}