46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package component
|
||
|
||
import "joylink.club/ecs"
|
||
|
||
// FluidPipe 流体管线
|
||
type FluidPipe struct {
|
||
Direction PipeFlowDirection //管线内综合流动方向
|
||
FlowSpeed float32 //管线内综合流量,m3/h
|
||
Sources []*SourceFlow //该管线内所有流体源投射的分量
|
||
}
|
||
|
||
// SourceFlow 流体源进入管线的流体描述
|
||
type SourceFlow struct {
|
||
Direction PipeFlowDirection
|
||
FlowSpeed float32
|
||
}
|
||
|
||
// PipeFlowDirection 管线内流体流动方向定义
|
||
type PipeFlowDirection int8
|
||
|
||
const (
|
||
PipeFlowNon PipeFlowDirection = iota //流体未流动
|
||
PipeFlowAb //流体从管线的A->B
|
||
PipeFlowBa //流体从管线的B->A
|
||
)
|
||
|
||
func (d *PipeFlowDirection) IsFlowAb() bool {
|
||
return *d == PipeFlowAb
|
||
}
|
||
func (d *PipeFlowDirection) IsFlowBa() bool {
|
||
return *d == PipeFlowBa
|
||
}
|
||
func (d *PipeFlowDirection) IsFlowNon() bool {
|
||
return *d == PipeFlowNon
|
||
}
|
||
|
||
// FluidDriver 流体驱动器
|
||
type FluidDriver struct {
|
||
On bool //true-输出流体驱动力;false-未输出流体驱动力
|
||
}
|
||
|
||
var (
|
||
FluidPipeType = ecs.NewComponentType[FluidPipe]() //流体管线
|
||
FluidDriverType = ecs.NewComponentType[FluidDriver]() //流体驱动器
|
||
)
|