-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgameoverScene.go
47 lines (38 loc) · 1.11 KB
/
gameoverScene.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package foodzy
import (
"github.com/co0p/foodzy/internal/ecs"
"github.com/co0p/foodzy/internal/scene"
"github.com/co0p/foodzy/internal/sound"
"time"
)
const GameOverSceneName = "gameover"
type GameOverScene struct {
scene.GameScene
startTime time.Time
actionStart ActionType
entityManager *ecs.EntityManager
}
func NewGameOverScene(soundManager *sound.SoundManager, actionStart ActionType) *GameOverScene {
entityManager := ecs.EntityManager{}
entityManager.AddEntity(NewBackground())
entityManager.AddEntity(NewFoodSpawner(40))
entityManager.AddEntity(NewGameOverTitle())
s := &GameOverScene{
startTime: time.Now(),
actionStart: actionStart,
entityManager: &entityManager,
}
s.Systems = append(s.Systems,
NewMovementSystem(&entityManager),
NewFoodSpawningSystem(&entityManager),
NewSpriteRenderSystem(&entityManager),
NewGameoverSystem(&entityManager, soundManager, actionStart),
NewTextRenderSystem(&entityManager),
NewDebugRendererSystem(&entityManager),
NewCleanupSystem(&entityManager, 10),
)
return s
}
func (s *GameOverScene) Name() string {
return GameOverSceneName
}