66 lines
2.0 KiB
Go
66 lines
2.0 KiB
Go
package entity
|
||
|
||
import (
|
||
"joylink.club/ecs"
|
||
"joylink.club/rtsssimulation/component"
|
||
)
|
||
|
||
// NewIscsFanEntity 创建风机实体
|
||
func NewIscsFanEntity(w ecs.World, id string) *ecs.Entry {
|
||
e := w.Entry(w.Create(component.UidType, component.FanType, component.FanStateType))
|
||
component.UidType.SetValue(e, component.Uid{Id: id})
|
||
return e
|
||
}
|
||
|
||
// NewIscsTwoSpeedFanEntity 创建双速风机实体
|
||
func NewIscsTwoSpeedFanEntity(w ecs.World, id string) *ecs.Entry {
|
||
entry := NewIscsFanEntity(w, id)
|
||
entry.AddComponent(component.TwoSpeedFanTag)
|
||
return entry
|
||
}
|
||
|
||
// NewAirConditioner 创建空调实体/空调器实体
|
||
//
|
||
// fc-true变频空调;
|
||
func NewAirConditioner(w ecs.World, id string, fc bool) *ecs.Entry {
|
||
entry := NewIscsFanEntity(w, id)
|
||
entry.HasComponent(component.AirConditionerTag)
|
||
component.FanType.Get(entry).Fc = fc
|
||
return entry
|
||
}
|
||
|
||
// NewCombinedAirConditioner 组合式空调(变频空调)
|
||
func NewCombinedAirConditioner(w ecs.World, id string) *ecs.Entry {
|
||
entry := NewAirConditioner(w, id, true)
|
||
entry.AddComponent(component.CombinedAirConditionerTag)
|
||
return entry
|
||
}
|
||
|
||
// NewElectricControlValve 创建电动调节阀实体
|
||
func NewElectricControlValve(w ecs.World, id string) *ecs.Entry {
|
||
e := w.Entry(w.Create(component.UidType, component.ElectricControlValveType, component.TwoPositionTransformType))
|
||
component.UidType.SetValue(e, component.Uid{Id: id})
|
||
return e
|
||
}
|
||
|
||
// NewElectricAirValve 创建电动风阀实体
|
||
func NewElectricAirValve(w ecs.World, id string) *ecs.Entry {
|
||
entry := NewElectricControlValve(w, id)
|
||
entry.AddComponent(component.ElectricAirValveTag)
|
||
return entry
|
||
}
|
||
|
||
// NewCombinationAirValve 创建组合式风阀
|
||
func NewCombinationAirValve(w ecs.World, id string) *ecs.Entry {
|
||
entry := NewElectricControlValve(w, id)
|
||
entry.AddComponent(component.CombinationAirValveTag)
|
||
return entry
|
||
}
|
||
|
||
// NewElectricTwoWayValve 创建电动两通调节阀实体
|
||
func NewElectricTwoWayValve(w ecs.World, id string) *ecs.Entry {
|
||
entry := NewElectricControlValve(w, id)
|
||
entry.AddComponent(component.ElectricTwoWayValveTag)
|
||
return entry
|
||
}
|