light sys

This commit is contained in:
xzb 2023-10-19 16:46:52 +08:00
parent 7cd8139a2f
commit b1c5ac236d

View File

@ -22,11 +22,7 @@ func (ls *LightSys) Update(w ecs.World) {
//灯当前状态,true-灯丝有电流false-灯丝没有电流
state := component.BitStateType.Get(entry)
//驱动灯亮或灭
if drive.Td != state.Val {
state.Val = drive.Td
}
//故障设置
state.Val = state.Val && !ls.calculateFault(entry)
state.Val = drive.Td && !ls.calculateFault(entry)
})
}
func (ls *LightSys) calculateFault(entry *ecs.Entry) bool {