Revert world object refactors
This commit is contained in:
+9
-9
@@ -17,13 +17,13 @@ Wave_Spawner :: struct {
|
||||
|
||||
start_wave :: proc(world: ^World) {
|
||||
if world.phase != .Build do return
|
||||
world.wave.current_wave += 1
|
||||
world.wave += 1
|
||||
world.phase = .Combat
|
||||
delete(world.wave.spawner.recipe)
|
||||
world.wave.spawner = Wave_Spawner {
|
||||
delete(world.spawner.recipe)
|
||||
world.spawner = Wave_Spawner {
|
||||
spawn_timer = 0,
|
||||
spawn_interval = 0.55,
|
||||
recipe = build_wave_recipe(world.wave.current_wave),
|
||||
recipe = build_wave_recipe(world.wave),
|
||||
recipe_index = 0,
|
||||
entry_remaining = 0,
|
||||
}
|
||||
@@ -56,7 +56,7 @@ build_wave_recipe :: proc(wave: int) -> [dynamic]Wave_Entry {
|
||||
}
|
||||
|
||||
load_next_recipe_entry :: proc(world: ^World) {
|
||||
s := &world.wave.spawner
|
||||
s := &world.spawner
|
||||
if s.recipe_index >= len(s.recipe) {
|
||||
s.entry_remaining = 0
|
||||
return
|
||||
@@ -66,7 +66,7 @@ load_next_recipe_entry :: proc(world: ^World) {
|
||||
}
|
||||
|
||||
clear_wave :: proc(world: ^World) -> bool {
|
||||
s := world.wave.spawner
|
||||
s := world.spawner
|
||||
if s.recipe_index < len(s.recipe) do return false
|
||||
if s.entry_remaining > 0 do return false
|
||||
return active_enemy_count(world) == 0
|
||||
@@ -74,7 +74,7 @@ clear_wave :: proc(world: ^World) -> bool {
|
||||
|
||||
update_wave :: proc(world: ^World, dt: f32) {
|
||||
if world.phase != .Combat do return
|
||||
s := &world.wave.spawner
|
||||
s := &world.spawner
|
||||
if s.entry_remaining <= 0 && s.recipe_index >= len(s.recipe) do return
|
||||
|
||||
s.spawn_timer -= dt
|
||||
@@ -101,11 +101,11 @@ update_phase :: proc(world: ^World) {
|
||||
}
|
||||
|
||||
check_end :: proc(world: ^World) {
|
||||
if world.player.base_health <= 0 {
|
||||
if world.base_health <= 0 {
|
||||
world.phase = .Game_Over
|
||||
}
|
||||
|
||||
if world.wave.current_wave >= MAX_WAVES && world.phase == .Build && clear_wave(world) {
|
||||
if world.wave >= MAX_WAVES && world.phase == .Build && clear_wave(world) {
|
||||
world.phase = .Victory
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user