extends Location

var itemDryingDelay = 0.6
var itemDryingTimer = 0.6

var waveSpawnDelay = 3.3
var waveSpawnTimer = 0

var waveScene = preload("res://Objects/Beach/Waves/MainWaterWave.tscn")
var waveScene2 = preload("res://Objects/Beach/Waves/MainWaterWave2.tscn")

var waveFlipped = false

func initialize_entry_locations():
	#From Park
	entryLocations.append(Vector2(-400, -2110))
	#From Forest
	entryLocations.append(Vector2(550, -2110))

func _process(delta):
	if GameVariables.player.swimmingZones.size() == 0:
		itemDryingTimer -= delta
		if itemDryingTimer <= 0:
			itemDryingTimer = itemDryingDelay
			InventoryManager.dry_player_inventory()
	
	if waveSpawnTimer <= 0:
		waveSpawnTimer = waveSpawnDelay
		spawn_wave()
	else:
		waveSpawnTimer -= delta

func spawn_wave():
	var newWave
	if !waveFlipped:
		newWave = waveScene.instantiate()
		waveFlipped = true
	else:
		newWave = waveScene2.instantiate()
		waveFlipped = false
	
	newWave.position = Vector2(65, -1201)
	$MainWaves.add_child(newWave)

func initialize_camera_limits():
	leftCameraLimit = -880
	rightCameraLimit = 880
	upperCameraLimit = -2200
	lowerCameraLimit = 2200
