This repository has been archived on 2024-07-02. You can view files and clone it, but cannot push or open issues or pull requests.
HoppyEaster/Scripts/GameManager.gd

26 lines
674 B
GDScript3
Raw Normal View History

2023-04-09 10:01:03 +00:00
extends Node2D
@export var map_generator : Node
@export var bunny_generator : Node
var bunnys = []
var gen_data : Dictionary
2023-04-09 21:22:44 +00:00
var wave : int
var in_wave_gen : bool
2023-04-09 10:01:03 +00:00
func _ready():
gen_data = map_generator.generate() as Dictionary
print("time for generation: " + str(gen_data.time))
pass
func _process(_delta):
2023-04-09 21:22:44 +00:00
if bunnys.size() == 0 and !in_wave_gen:
in_wave_gen = true
2023-04-09 10:01:03 +00:00
wave += 1
2023-04-09 21:22:44 +00:00
bunnys = await bunny_generator.spawn_batched_wave(5.0, 0.25, gen_data.free_tiles.duplicate(), TEAM.EVIL, wave * 10.0, 3)
2023-04-09 10:01:03 +00:00
for bunny in bunnys:
bunny.sub_on_death(func(bunny): bunnys.erase(bunny))
bunny.sub_on_death(func(bunny): bunny.queue_free())
2023-04-09 21:22:44 +00:00
in_wave_gen = false
2023-04-09 10:01:03 +00:00
pass