rts-sim-module/entities/switch_entity.go

20 lines
661 B
Go
Raw Normal View History

2023-09-13 10:05:42 +08:00
package entities
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/system"
)
// 双机zdj9
func CreateSwitch2jzdj9Entity(w ecs.World, switchId string) *ecs.Entry {
2023-09-13 18:03:55 +08:00
e := w.Create(system.EntityIdentityComponent, system.Switch2jZdj9StateComponent, system.TimeMovableObject1Component, system.TimeMovableObject2Component)
2023-09-13 10:05:42 +08:00
system.EntityIdentityComponent.Set(e, &system.EntityIdentity{Id: switchId})
2023-09-13 18:03:55 +08:00
//电路
system.Switch2jZdj9StateComponent.Set(e, system.NewSwitch2jZdj9State())
//J1
system.TimeMovableObject1Component.Set(e, system.NewTimeMovableObject())
//J2
system.TimeMovableObject2Component.Set(e, system.NewTimeMovableObject())
2023-09-13 10:05:42 +08:00
return e
}