15 lines
418 B
Go
15 lines
418 B
Go
package entities
|
|
|
|
import (
|
|
"joylink.club/ecs"
|
|
"joylink.club/rtsssimulation/system"
|
|
)
|
|
|
|
// CreateRelayEntity 创建继电器实体
|
|
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
|
|
}
|