道岔测试
This commit is contained in:
parent
ac124623a7
commit
18c7a33cdc
@ -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()
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user