From 9d4c0cf16473e0fe6b10b48c7b3c17383953fccf Mon Sep 17 00:00:00 2001 From: xzb <223@qq.com> Date: Wed, 27 Sep 2023 13:17:58 +0800 Subject: [PATCH] spks emps --- entities/emps_entity.go | 13 +++++++++++++ entities/spks_entity.go | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 entities/emps_entity.go diff --git a/entities/emps_entity.go b/entities/emps_entity.go new file mode 100644 index 0000000..f522f79 --- /dev/null +++ b/entities/emps_entity.go @@ -0,0 +1,13 @@ +package entities + +import ( + "joylink.club/ecs" + "joylink.club/rtsssimulation/system" +) + +func CreateEmpsCircuitEntity(w ecs.World, empsCircuitId string) *ecs.Entry { + e := w.Create(system.EntityIdentityComponent, system.EmpsCircuitStateComponent) + system.EntityIdentityComponent.Set(e, &system.EntityIdentity{Id: empsCircuitId}) + system.EmpsCircuitStateComponent.Set(e, system.NewEmpsCircuitState()) + return e +} diff --git a/entities/spks_entity.go b/entities/spks_entity.go index 1899b98..5cb9b6e 100644 --- a/entities/spks_entity.go +++ b/entities/spks_entity.go @@ -1 +1,14 @@ package entities + +import ( + "joylink.club/ecs" + "joylink.club/rtsssimulation/system" +) + +// CreateSpksCircuitEntity 创建人员防护按钮电路实体 +func CreateSpksCircuitEntity(w ecs.World, spksCircuitId string) *ecs.Entry { + e := w.Create(system.EntityIdentityComponent, system.SpksCircuitStateComponent) + system.EntityIdentityComponent.Set(e, &system.EntityIdentity{Id: spksCircuitId}) + system.SpksCircuitStateComponent.Set(e, system.NewSpksCircuitState()) + return e +}