本文整理汇总了Golang中github.com/paked/engi/ecs.NewSystem函数的典型用法代码示例。如果您正苦于以下问题:Golang NewSystem函数的具体用法?Golang NewSystem怎么用?Golang NewSystem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewSystem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: New
func (m *Maze) New(w *ecs.World) {
ActiveMazeSystem = m
m.System = ecs.NewSystem()
m.World = w
tilePlayer = helpers.GenerateSquareComonent(tilePlayerColor, tilePlayerColor, tileWidth, tileHeight, engi.MiddleGround)
tileWall = helpers.GenerateSquareComonent(tileWallColor, tileWallColor, tileWidth, tileHeight, engi.ScenicGround+1)
tileBlank = helpers.GenerateSquareComonent(tileBlankColor, tileBlankColor, tileWidth, tileHeight, engi.ScenicGround+2)
tileGoal = helpers.GenerateSquareComonent(tileGoalColor, tileGoalColor, tileWidth, tileHeight, engi.ScenicGround+3)
tileRoute = helpers.GenerateSquareComonent(tileRouteColor, tileRouteColor, tileWidth, tileHeight, engi.ScenicGround+4)
m.levels = LoadLevels(m.LevelDirectory)
engi.Mailbox.Listen("MazeMessage", func(msg engi.Message) {
mazeMsg, ok := msg.(MazeMessage)
if !ok {
return
}
m.cleanup()
if mazeMsg.Sequence == SequenceDescending {
m.sequenceIndex = len(m.levels) - 1
}
m.sequence = mazeMsg.Sequence
m.initialize(mazeMsg.LevelName)
})
}
示例2: New
func (ds *DeathSystem) New(*ecs.World) {
ds.System = ecs.NewSystem()
// Subscribe to ScoreMessage
engi.Mailbox.Listen("ScoreMessage", func(message engi.Message) {
collision, isCollision := message.(engi.CollisionMessage)
if isCollision {
log.Println(collision, message)
log.Println("DEAD")
}
})
}
示例3: New
func (ms *SpeedSystem) New(*ecs.World) {
ms.System = ecs.NewSystem()
engi.Mailbox.Listen("CollisionMessage", func(message engi.Message) {
log.Println("collision")
collision, isCollision := message.(engi.CollisionMessage)
if isCollision {
var speed *SpeedComponent
if !collision.Entity.Component(&speed) {
return
}
speed.X *= -1
}
})
}
示例4: New
func (as *AudioSystem) New(*ecs.World) {
as.System = ecs.NewSystem()
if as.HeightModifier == 0 {
as.HeightModifier = defaultHeightModifier
}
if err := al.OpenDevice(); err != nil {
log.Println("Error initializing AudioSystem:", err)
return
}
Mailbox.Listen("CameraMessage", func(msg Message) {
_, ok := msg.(CameraMessage)
if !ok {
return
}
// Hopefully not that much of an issue, when we receive it before the CameraSystem does
// TODO: but it is when the CameraMessage is not Incremental (i.e. the changes are big)
al.SetListenerPosition(al.Vector{cam.X() / Width(), cam.Y() / Height(), cam.Z() * as.HeightModifier})
})
}
示例5: New
func (c *Calibrate) New(w *ecs.World) {
ActiveCalibrateSystem = c
c.System = ecs.NewSystem()
c.World = w
var err error
c.Connection, err = gobci.Connect("")
if err != nil {
log.Fatal(err)
}
err = c.Connection.FlushData()
if err != nil {
log.Fatal("FlushData error: ", err)
}
// Get latest header info
c.Header, err = c.Connection.GetHeader()
if err != nil {
log.Fatal("GetHeader error: ", err)
}
for i := uint32(0); i < c.Header.NChannels; i++ {
e := ecs.NewEntity([]string{c.Type(), "RenderSystem"})
espace := &engi.SpaceComponent{engi.Point{0, float32(i * (3*dpi + 10))}, 0, 0}
e.AddComponent(espace)
if c.Visualize {
e.AddComponent(&CalibrateComponent{i})
}
c.AddEntity(e)
c.World.AddEntity(e)
}
}
示例6: New
func (rs *RenderSystem) New(w *ecs.World) {
rs.renders = make(map[PriorityLevel][]*ecs.Entity)
rs.System = ecs.NewSystem()
rs.world = w
rs.ShouldSkipOnHeadless = true
if !headless {
if !Shaders.setup {
Shaders.def.Initialize(Width(), Height())
hud := &HUDShader{}
hud.Initialize(Width(), Height())
for i := HUDGround; i <= HighestGround; i++ {
Shaders.Register(i, hud)
}
Shaders.setup = true
}
}
Mailbox.Listen("renderChangeMessage", func(m Message) {
rs.changed = true
})
}
示例7: New
func (f *FPS) New(w *ecs.World) {
f.System = ecs.NewSystem()
f.World = w
f.AddEntity(ecs.NewEntity([]string{f.Type()}))
}
示例8: New
func (a *MovementSystem) New(*ecs.World) {
a.System = ecs.NewSystem()
}
示例9: New
func (as *AudioSystem) New(*ecs.World) {
as.System = ecs.NewSystem()
log.Println("Warning: audio is not yet implemented on Windows")
}
示例10: New
func (cs *CollisionSystem) New(*ecs.World) {
cs.System = ecs.NewSystem()
}
示例11: New
func (h *Hud) New(*ecs.World) {
h.System = ecs.NewSystem()
}
示例12: New
func (ns *NilSystem) New() {
ns.System = ecs.NewSystem()
}
示例13: New
func (s *HideSystem) New(*ecs.World) {
s.System = ecs.NewSystem()
}
示例14: New
func (m *MenuListener) New(w *ecs.World) {
m.System = ecs.NewSystem()
m.AddEntity(ecs.NewEntity([]string{m.Type()}))
}
示例15: New
func (s *ScaleSystem) New(*ecs.World) {
s.System = ecs.NewSystem()
}