rts-sim-module/deprecated/entities/button_entity.go

24 lines
951 B
Go
Raw Normal View History

2023-09-27 16:16:51 +08:00
package entities
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/deprecated/system"
2023-09-27 16:16:51 +08:00
)
// 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
}