rts-sim-module/fi/circuit.go

43 lines
904 B
Go
Raw Normal View History

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
}
// 驱动电路状态修改
// x,y:二维数组的索引
// state : 32位的bool数组
2023-10-24 10:53:54 +08:00
func DriveCircuitStateChange(w ecs.World, x, y int, state bool) {
}