2023-10-23 15:56:45 +08:00
|
|
|
package fi
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"joylink.club/ecs"
|
|
|
|
"joylink.club/rtsssimulation/component"
|
|
|
|
"joylink.club/rtsssimulation/entity"
|
|
|
|
)
|
|
|
|
|
|
|
|
// 采集继电器吸起电路状态
|
|
|
|
func CollectXQCircuitState(w ecs.World, id string) bool {
|
|
|
|
wd := entity.GetWorldData(w)
|
|
|
|
entry, ok := wd.EntityMap[id]
|
|
|
|
if ok {
|
|
|
|
state := component.BitStateType.Get(entry)
|
|
|
|
return state.Val
|
|
|
|
} else {
|
|
|
|
fmt.Printf("未找到id=%s的继电器\n", id)
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
// 采集继电器落下电路状态
|
|
|
|
func CollectLXCircuitState(w ecs.World, id string) bool {
|
|
|
|
wd := entity.GetWorldData(w)
|
|
|
|
entry, ok := wd.EntityMap[id]
|
|
|
|
if ok {
|
|
|
|
state := component.BitStateType.Get(entry)
|
|
|
|
return !state.Val
|
|
|
|
} else {
|
|
|
|
fmt.Printf("未找到id=%s的继电器\n", id)
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
2023-10-24 10:48:29 +08:00
|
|
|
|
|
|
|
// 驱动电路状态修改
|
|
|
|
// x,y:二维数组的索引
|
|
|
|
// state : 32位的bool数组
|
|
|
|
func DriveCircuitStateChange(w ecs.World, x, y int32, state bool) {
|
|
|
|
|
|
|
|
}
|