19 lines
416 B
Go
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
|
||
|
}
|