rts-sim-module/entities/switch_entity.go

28 lines
758 B
Go
Raw Normal View History

2023-09-13 10:05:42 +08:00
package entities
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/system"
)
2023-09-15 13:50:15 +08:00
// CreateSwitch2jzdj9Entity 双机zdj9
2023-09-14 13:52:36 +08:00
// 默认定位
2023-09-13 10:05:42 +08:00
func CreateSwitch2jzdj9Entity(w ecs.World, switchId string) *ecs.Entry {
2023-09-15 15:07:41 +08:00
e := w.Create(system.EntityIdentityComponent,
system.Switch2jZdj9StateComponent,
system.MovableObject1Component,
system.MovableObject2Component)
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
2023-09-14 13:52:36 +08:00
j1 := system.NewMovableObject()
j1.Value = system.J1Range
system.MovableObject1Component.Set(e, j1)
2023-09-13 18:03:55 +08:00
//J2
2023-09-14 13:52:36 +08:00
j2 := system.NewMovableObject()
j2.Value = system.J2Range
system.MovableObject2Component.Set(e, j2)
2023-09-13 10:05:42 +08:00
return e
}