33 lines
1009 B
Go
33 lines
1009 B
Go
package entity
|
||
|
||
import (
|
||
"joylink.club/ecs"
|
||
"joylink.club/rtsssimulation/component"
|
||
)
|
||
|
||
// NewTFDSHostEntity 创建TFDS主机实体
|
||
func NewTFDSHostEntity(w ecs.World, id string, checkPoints []*ecs.Entry) *ecs.Entry {
|
||
wd := GetWorldData(w)
|
||
e, ok := wd.EntityMap[id]
|
||
if !ok {
|
||
//TFDS主机状态:网络主机状态+被监控的感温光纤的状态
|
||
//被监控的感温光纤的状态:有被监控的光纤上的所有检测点的状态综合计算得到
|
||
e := w.Entry(w.Create(component.UidType, component.NetworkHostType, component.TFDSHostType))
|
||
component.UidType.SetValue(e, component.Uid{Id: id})
|
||
wd.EntityMap[id] = e
|
||
}
|
||
return e
|
||
}
|
||
|
||
// NewTofCheckPointEntity 创建感温光纤工程检测点实体
|
||
func NewTofCheckPointEntity(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.TofCheckPointType))
|
||
component.UidType.SetValue(e, component.Uid{Id: id})
|
||
wd.EntityMap[id] = e
|
||
}
|
||
return e
|
||
}
|