24 lines
940 B
Go
24 lines
940 B
Go
package entities
|
|
|
|
import (
|
|
"joylink.club/ecs"
|
|
"joylink.club/rtsssimulation/system"
|
|
)
|
|
|
|
// CreateSelfResetButtonEntity 创建自复位按钮实体
|
|
func CreateSelfResetButtonEntity(w ecs.World, buttonId string) *ecs.Entry {
|
|
e := w.Create(system.EntityIdentityComponent, system.ButtonStateComponent, system.ButtonSelfRestTag)
|
|
system.EntityIdentityComponent.Set(e, &system.EntityIdentity{Id: buttonId})
|
|
system.ButtonStateComponent.Set(e, system.NewButtonState())
|
|
system.ButtonSelfRestTag.Set(e, &system.ButtonSelfRestState{KeepAxTime: 0})
|
|
return e
|
|
}
|
|
|
|
// CreateNonResetButtonEntity 创建非自复位按钮实体
|
|
func CreateNonResetButtonEntity(w ecs.World, buttonId string) *ecs.Entry {
|
|
e := w.Create(system.EntityIdentityComponent, system.ButtonStateComponent, system.ButtonNonRestTag)
|
|
system.EntityIdentityComponent.Set(e, &system.EntityIdentity{Id: buttonId})
|
|
system.ButtonStateComponent.Set(e, system.NewButtonState())
|
|
return e
|
|
}
|