package iscs_sys import ( "joylink.club/ecs" "joylink.club/ecs/filter" "joylink.club/rtsssimulation/component" ) // AirConditionerSystem 空调 type AirConditionerSystem struct { query *ecs.Query } func NewAirConditionerSystem() *AirConditionerSystem { return &AirConditionerSystem{ query: ecs.NewQuery(filter.Contains(component.UidType, component.MotorType, component.AirConditioningType)), } } func (s *AirConditionerSystem) Update(w ecs.World) { s.query.Each(w, func(entry *ecs.Entry) { motor := component.MotorType.Get(entry) air := component.AirConditioningType.Get(entry) // air.Running = motor.Speed > 0 }) }