rts-sim-module/entities/switch_entity.go
2023-09-21 14:12:33 +08:00

28 lines
758 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.MovableObject1Component,
system.MovableObject2Component)
system.EntityIdentityComponent.Set(e, &system.EntityIdentity{Id: switchId})
//电路
system.Switch2jZdj9StateComponent.Set(e, system.NewSwitch2jZdj9State())
//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
}