From 74d01410878ca1ca7ab4d0ec66d56aee59f84bf0 Mon Sep 17 00:00:00 2001 From: soul-walker Date: Fri, 14 Jun 2024 16:56:55 +0800 Subject: [PATCH] model and component adjustment --- component/component.go | 11 +++++++++-- model/model.go | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/component/component.go b/component/component.go index 41a8b6f..2bfbb7e 100644 --- a/component/component.go +++ b/component/component.go @@ -1,6 +1,13 @@ package component -// 道岔驱采组件 +import "joylink.club/ecs" + +var ( + TurnoutQcType = ecs.NewComponentType[TurnoutQc]() + LimitMotorType = ecs.NewComponentType[LimitMotor]() +) + +// 道岔驱采状态 type TurnoutQc struct { CJ bool DCJ bool @@ -9,7 +16,7 @@ type TurnoutQc struct { FBJ bool } -// 限位电机组件 +// 限位电机状态 type LimitMotor struct { Min int Max int diff --git a/model/model.go b/model/model.go index 56fb926..c002583 100644 --- a/model/model.go +++ b/model/model.go @@ -4,3 +4,28 @@ type RtssModel interface { // RtssModel unique id Uid() string } + +// 轨道端口 +type PipePort = string + +var ( + // PipePortA 轨道端口A + PipePortA PipePort = "A" + // PipePortB 轨道端口B + PipePortB PipePort = "B" + // PipePortC 轨道端口C + PipePortC PipePort = "C" +) + +type PipeLink struct { + // 轨道 + Pipe Pipe + // 端口 + Port PipePort +} + +// 轨道 +type Pipe interface { + // 获取指定端口连接的下一个轨道及端口 + Next(port PipePort) PipeLink +}