rts-sim-module/entities/signal_entity.go

30 lines
1.4 KiB
Go
Raw Normal View History

2023-09-13 10:05:42 +08:00
package entities
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/system"
)
func CreateSignal3XH1Entity(w ecs.World, signalId string) *ecs.Entry {
2023-09-18 10:37:17 +08:00
e := w.Create(system.EntityIdentityComponent, system.Signal3XH1StateComponent, system.Signal3XH1FilamentStateComponent)
2023-09-13 10:05:42 +08:00
system.EntityIdentityComponent.Set(e, &system.EntityIdentity{Id: signalId})
system.Signal3XH1StateComponent.Set(e, system.NewSignal3XH1State())
2023-09-18 10:37:17 +08:00
system.Signal3XH1FilamentStateComponent.Set(e, system.NewSignal3XH1FilamentState())
2023-09-13 10:05:42 +08:00
return e
}
2023-09-18 13:16:31 +08:00
func CreateSignal2XH1CdcEntity(w ecs.World, signalId string) *ecs.Entry {
e := w.Create(system.EntityIdentityComponent, system.Signal2XH1StateComponent, system.Signal2XH1FilamentStateComponent)
system.EntityIdentityComponent.Set(e, &system.EntityIdentity{Id: signalId})
system.Signal2XH1StateComponent.Set(e, system.NewSignal2XH1CdcState())
system.Signal2XH1FilamentStateComponent.Set(e, system.NewSignal2XH1FilamentState())
return e
}
func CreateSignal2XH1CzqzEntity(w ecs.World, signalId string) *ecs.Entry {
e := w.Create(system.EntityIdentityComponent, system.Signal2XH1StateComponent, system.Signal2XH1FilamentStateComponent)
system.EntityIdentityComponent.Set(e, &system.EntityIdentity{Id: signalId})
system.Signal2XH1StateComponent.Set(e, system.NewSignal2XH1CzqzState())
system.Signal2XH1FilamentStateComponent.Set(e, system.NewSignal2XH1FilamentState())
return e
}