【修改ibp电路逻辑】

This commit is contained in:
weizhihong 2023-12-07 18:07:05 +08:00
parent 3582864835
commit 1798ee0a69

View File

@ -8,26 +8,30 @@ import (
// ibp 系统
type IBPSys struct {
query *ecs.Query
empQuery *ecs.Query
spksQuery *ecs.Query
}
// ibp盘系统
func NewIBPSys() *IBPSys {
return &IBPSys{
query: ecs.NewQuery(filter.Contains(component.SpkElectronicType, component.EmpElectronicType)),
empQuery: ecs.NewQuery(filter.Contains(component.EmpElectronicType)),
spksQuery: ecs.NewQuery(filter.Contains(component.SpkElectronicType)),
}
}
// 控制电路更新
func (ibp *IBPSys) Update(w ecs.World) {
ibp.query.Each(w, func(entry *ecs.Entry) {
spkState := component.SpkElectronicType.Get(entry)
ibp.spkControl(entry, spkState)
ibp.spksState(entry, spkState)
ibp.empQuery.Each(w, func(entry *ecs.Entry) {
empState := component.EmpElectronicType.Get(entry)
ibp.empControl(entry, empState)
ibp.empState(entry, empState)
})
ibp.spksQuery.Each(w, func(entry *ecs.Entry) {
spkState := component.SpkElectronicType.Get(entry)
ibp.spkControl(entry, spkState)
ibp.spksState(entry, spkState)
})
}
// 人员防护继电器控制电路逻辑