rts-sim-module/entities/switch_entity.go
2023-09-15 15:07:41 +08:00

30 lines
874 B
Go

package entities
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/system"
)
// CreateSwitch2jzdj9Entity 双机zdj9
// 默认定位
func CreateSwitch2jzdj9Entity(w ecs.World, switchId string) *ecs.Entry {
e := w.Create(system.EntityIdentityComponent,
system.Switch2jZdj9StateComponent,
system.Switch2jZdj9CjStateComponent,
system.MovableObject1Component,
system.MovableObject2Component)
system.EntityIdentityComponent.Set(e, &system.EntityIdentity{Id: switchId})
//电路
system.Switch2jZdj9StateComponent.Set(e, system.NewSwitch2jZdj9State())
system.Switch2jZdj9CjStateComponent.Set(e, system.NewSwitch2jZdj9CjState())
//J1
j1 := system.NewMovableObject()
j1.Value = system.J1Range
system.MovableObject1Component.Set(e, j1)
//J2
j2 := system.NewMovableObject()
j2.Value = system.J2Range
system.MovableObject2Component.Set(e, j2)
return e
}