道岔测试

This commit is contained in:
xzb 2023-09-26 15:28:29 +08:00
parent ac124623a7
commit 18c7a33cdc
2 changed files with 11 additions and 18 deletions

View File

@ -44,14 +44,7 @@ func Test() {
system.Switch2jZdj9DriveFc(world, "sw1", true)
//
time.Sleep(12 * time.Second)
system.Switch2jZdj9DriveYc(world, "sw1", false)
system.Switch2jZdj9DriveFc(world, "sw1", false)
time.Sleep(1 * time.Second)
//联锁驱动定操
system.Switch2jZdj9DriveYc(world, "sw1", true)
system.Switch2jZdj9DriveDc(world, "sw1", true)
//
time.Sleep(12 * time.Second)
world.Close()
}

View File

@ -71,19 +71,19 @@ func NewPercentageMovableSystem() *PercentageMovableSystem {
// Update world 执行
func (me *PercentageMovableSystem) Update(w ecs.World) {
me.query.Each(w, func(e *ecs.Entry) {
var state *PercentageDeviceState
if e.HasComponent(PercentageDeviceStateComponent) {
state = PercentageDeviceStateComponent.Get(e)
}
if e.HasComponent(PercentageDeviceState1Component) {
state = PercentageDeviceState1Component.Get(e)
}
if e.HasComponent(PercentageDeviceState2Component) {
state = PercentageDeviceState2Component.Get(e)
}
if state != nil {
state := PercentageDeviceStateComponent.Get(e)
me.move(w, state)
}
if e.HasComponent(PercentageDeviceState1Component) {
state := PercentageDeviceState1Component.Get(e)
me.move(w, state)
}
if e.HasComponent(PercentageDeviceState2Component) {
state := PercentageDeviceState2Component.Get(e)
me.move(w, state)
}
})
}
func (me *PercentageMovableSystem) move(w ecs.World, state *PercentageDeviceState) {