summaryrefslogtreecommitdiff
path: root/engine/Components
diff options
context:
space:
mode:
Diffstat (limited to 'engine/Components')
-rw-r--r--engine/Components/World.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/engine/Components/World.go b/engine/Components/World.go
index c7a96df..ccbe99f 100644
--- a/engine/Components/World.go
+++ b/engine/Components/World.go
@@ -13,27 +13,34 @@ type World struct {
StaticObjects []coreobjects.GameObject
Player *Player
-
Camera *rl.Camera2D
-
layersStatic layering
// ========== Cache ==========
// the collection of the colliders that belong to static objects - world, buildings, etc
staticColliders []*coreobjects.Collider
+
+ updateQueue []coreobjects.UpdateFunction
}
func (base *World) Create(manager *coreobjects.SceneManager) {
base.Manager = manager
base.Player.Init(manager)
+ // The max length will be higher but this length is guaranteed
+ base.updateQueue = make([]coreobjects.UpdateFunction, 0, len(base.StaticObjects))
for _, v := range base.StaticObjects {
v.Init(manager)
+ base.updateQueue = append(base.updateQueue, v.Update)
}
base.layersStatic = layering{}
base.generateStaticLayers()
}
+func (base *World) GetUpdateFunctions() []coreobjects.UpdateFunction {
+ return base.updateQueue
+}
+
func (base *World) Destroy() {
base.Player.Destroy()
}