rts-sim-module/entities/relay_entity.go

15 lines
418 B
Go
Raw Normal View History

2023-09-15 13:07:31 +08:00
package entities
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/system"
)
2023-09-15 13:50:15 +08:00
// CreateRelayEntity 创建继电器实体
2023-09-15 13:07:31 +08:00
func CreateRelayEntity(w ecs.World, relayId string) *ecs.Entry {
e := w.Create(system.EntityIdentityComponent, system.RelayStateComponent)
system.EntityIdentityComponent.Set(e, &system.EntityIdentity{Id: relayId})
system.RelayStateComponent.Set(e, system.NewRelayState())
return e
}