--[[
Author: Will Graham (wgraham@digipen.edu)

Copyright 2008-2009 DigiPen (USA) Corp.
]]--

--print("CaveLevel_Init.lua")

StartPos = LvlLoader:GetInfo("playerStart01").Pos_
EventManager:AddEvent(false, 0.0, "PlayerData:SetRimColor(Vector3D(0.0, 0.0, 0.0), 0.0)")
--GameEngine.CheckPoint = 1
TorchList = {}
if GameEngine.CheckPoint == 0 then
	if GameEngine.FirstRun == true then
		cameraStartPos = LvlLoader:GetInfo("cameraPosition01").Pos_
		EventManager:AddEvent(false, 0.0, "PlayerData:LockPlayer(Vector3D(0.0, 0.0, 0.0))")
		EventManager:AddEvent(false, 0.0, "PlayerData:SetCameraPosition(Vector3D(0.0, 20.0, 0.0), 0.04, true, true)")
		EventManager:AddEvent(false, 3.5, "TorchList[47]:ActivateLight()")
		
		EventManager:AddEvent(false, 3.0, "PlayerData:SetEmissiveColor(Vector3D(0.25, 0.0, 0.0), true)")
		EventManager:AddEvent(false, 3.1, "PlayerData:SetEmissiveColor(Vector3D(0.0, 0.0, 0.0), true)")
		EventManager:AddEvent(false, 3.3, "PlayerData:SetEmissiveColor(Vector3D(0.5, 0.0, 0.0), true)")
		EventManager:AddEvent(false, 3.5, "PlayerData:SetEmissiveColor(Vector3D(0.0, 0.0, 0.0), true)")
		EventManager:AddEvent(false, 3.7, "PlayerData:SetEmissiveColor(Vector3D(0.75, 0.0, 0.0), true)")
		EventManager:AddEvent(false, 4.0, "PlayerData:SetEmissiveColor(Vector3D(0.0, 0.0, 0.0), true)")
		EventManager:AddEvent(false, 4.3, "PlayerData:SetEmissiveColor(Vector3D(10.0, 0.2, 0.2), true)")
		
		EventManager:AddEvent(false, 5.0, "PlayerData:SetRimColor(Vector3D(0.0, 0.3, 1.0), 1.0)")
		EventManager:AddEvent(false, 4.8, "PlayerData:ToggleLight(true)")
		
		EventManager:AddEvent(false, 6.0, "PlayerData:SetCameraPosition(Vector3D(25.0, 25.0, 25.0), 0.04, true, true)")
		EventManager:AddEvent(false, 6.1, "PlayerData:SetCameraPosition(Vector3D(50.0, 0.0, 25.0), 0.04, true, true)")
		EventManager:AddEvent(false, 6.2, "PlayerData:SetCameraPosition(Vector3D(25.0,-25.0, 25.0), 0.04, true, true)")
		EventManager:AddEvent(false, 6.3, "PlayerData:SetCameraPosition(Vector3D(0.0, -50.0, 25.0), 0.04, true, true)")
		EventManager:AddEvent(false, 7.0, "PlayerData:SetCameraPosition(DefaultCameraVec, DefaultCameraSpeed, DefaultCameraRelative, DefaultCameraFixed)")
		
		EventManager:AddEvent(false, 7.0, "PlayerData:UnlockPlayer()")

		EventManager:AddEvent(false, 6.5, "TorchList[1]:ActivateLight()")
		EventManager:AddEvent(false, 6.5, "TorchList[2]:ActivateLight()")
		EventManager:AddEvent(false, 7.5, "TorchList[3]:ActivateLight()")
		EventManager:AddEvent(false, 7.5, "TorchList[4]:ActivateLight()")
		EventManager:AddEvent(false, 8.5, "TorchList[5]:ActivateLight()")
		EventManager:AddEvent(false, 8.5, "TorchList[6]:ActivateLight()")
		
		GameEngine.FirstRun = false
	else
		cameraStartPos = LvlLoader:GetInfo("cameraPosition02").Pos_
		EventManager:AddEvent(false, 0.0, "PlayerData:LockPlayer(Vector3D(0.0, 0.0, 0.0))")
		EventManager:AddEvent(false, 0.0, "PlayerData:SetCameraPosition(Vector3D(0.0, -50.0, 25.0), 0.04, true, true)")
		EventManager:AddEvent(false, 0.4, "PlayerData:SetCameraPosition(DefaultCameraVec, DefaultCameraSpeed, DefaultCameraRelative, DefaultCameraFixed)")
		EventManager:AddEvent(false, 0.0, "TorchList[47]:ActivateLight()")
		EventManager:AddEvent(false, 0.0, "PlayerData:SetEmissiveColor(Vector3D(1.0, 0.0, 0.0), true)")
		EventManager:AddEvent(false, 0.0, "PlayerData:ToggleLight(true)")
		EventManager:AddEvent(false, 0.0, "PlayerData:SetRimColor(Vector3D(0.0, 0.3, 1.0), 1.0)")
		EventManager:AddEvent(false, 0.5, "PlayerData:UnlockPlayer()")
		
		EventManager:AddEvent(false, 0.5, "TorchList[1]:ActivateLight()")
		EventManager:AddEvent(false, 0.5, "TorchList[2]:ActivateLight()")
		EventManager:AddEvent(false, 1.5, "TorchList[3]:ActivateLight()")
		EventManager:AddEvent(false, 1.5, "TorchList[4]:ActivateLight()")
		EventManager:AddEvent(false, 2.5, "TorchList[5]:ActivateLight()")
		EventManager:AddEvent(false, 2.5, "TorchList[6]:ActivateLight()")
	end

	for i = 1, 11 do
		local lavaName = "lavaPool"
		
		if i < 10 then
			lavaName = lavaName .. 0 .. i	
		else
			lavaName = lavaName .. i
		end
		
		Info = LvlLoader:GetInfo(lavaName)
		
		GlobalSpawnController:SpawnLavaPool(Info.Pos_, Info.Scale_, Info.Rot_, 300.0, 500.0)
	end

	local NumberOfTorches = 49
	for i = 1, NumberOfTorches do
	
		local torchName = "torch"
		
		if i < 10 then
			torchName = torchName .. 0 .. i
		else
			torchName = torchName .. i
		end
		
		Info = LvlLoader:GetInfo(torchName)
		TorchList[i] =	GlobalSpawnController:SpawnTorch(Info.Pos_, Info.Scale_, Info.Rot_, Vector3D(0.2, 0.2, 1.5), 1.2, 20.0, true)
	end

	local NumberOfPlatforms = 30
	PlatformList = {}
	for i = 1, NumberOfPlatforms do
		local platformName = "platform"
		
		if i < 10 then
			platformName = platformName .. 0 .. i
		else
			platformName = platformName .. i
		end
		
		Info = LvlLoader:GetInfo(platformName)
		PlatformList[i] =	GlobalSpawnController:SpawnPlatform2(Info.Pos_, Info.Scale_, Info.Rot_)
	end

	local NumberOfSpawnPoints = 36
	SpawnPointList = {}
	for i = 1, NumberOfSpawnPoints do
		local spawnName = "spawnPoint"
		
		if i < 10 then
			spawnName = spawnName .. 0 .. i
		else
			spawnName = spawnName .. i
		end
		
		SpawnPointList[i] = LvlLoader:GetInfo(spawnName)
	end

	SpawnTowerInfo(LvlLoader:GetInfo("blockTower01"), true, false)
	SpawnTowerInfo(LvlLoader:GetInfo("blockTower02"), true, false)
	SpawnTowerInfo(LvlLoader:GetInfo("blockTower03"), true, false)
	SpawnTowerInfo(LvlLoader:GetInfo("blockTower04"), true, false)
	SpawnTowerInfo(LvlLoader:GetInfo("blockTower05"), true, false)
	SpawnTowerInfo(LvlLoader:GetInfo("blockTower06"), true, false)
	SpawnTowerInfo(LvlLoader:GetInfo("blockTower07"), true, false)

	RaftInfo = LvlLoader:GetInfo("raftSpawn01")
	GlobalSpawnController:PushSpawn(SpawnPoint(RaftInfo.Pos_, Vector3D(0.0, 0.0, 0.0), 3.0, 5.0, 0.0, GlobalSpawnController, RaftInfo.Scale_, 19))
	RaftInfo = LvlLoader:GetInfo("raftSpawn02")
	GlobalSpawnController:PushSpawn(SpawnPoint(RaftInfo.Pos_, Vector3D(0.0, 0.0, 0.0), 3.0, 5.0, 0.0, GlobalSpawnController, RaftInfo.Scale_, 19))

	RaftDestroyerInfo = LvlLoader:GetInfo("raftDestroyer01")
	GlobalSpawnController:SpawnRaftDestroyer(RaftDestroyerInfo.Pos_, RaftDestroyerInfo.Scale_, RaftDestroyerInfo.Rot_)

	BlobRadius = 3.0

	TargetEnemy = nil;
	SpawnTriggerInfo(LvlLoader:GetInfo("trigger01"), false, false, 
	[[
		GlobalSpawnController:ClearSpawns();
		
		EventManager:AddEvent(false, 0.0, "PlayerData:LockPlayer(Vector3D(0.0, 1.0, 0.0)");
		
		EventManager:AddEvent(false, 0.4, "GlobalSpawnController:SpawnBlob(SpawnPointList[32].Pos_, Vector3D( 0.0, 500.0, 200.0), 2 * BlobRadius, 30.0, true)");
		EventManager:AddEvent(false, 0.2, "GlobalSpawnController:SpawnBlob(SpawnPointList[33].Pos_, Vector3D( 0.0, 500.0, 200.0), 2 * BlobRadius, 30.0, true)");
		EventManager:AddEvent(false, 0.0, "TargetEnemy = GlobalSpawnController:SpawnBlob(SpawnPointList[34].Pos_, Vector3D( 0.0, 500.0, 250.0), 2 * BlobRadius, 30.0, true)");
		EventManager:AddEvent(false, 0.2, "GlobalSpawnController:SpawnBlob(SpawnPointList[35].Pos_, Vector3D( 0.0, 500.0, 200.0), 2 * BlobRadius, 30.0, true)");
		EventManager:AddEvent(false, 0.4, "GlobalSpawnController:SpawnBlob(SpawnPointList[36].Pos_, Vector3D( 0.0, 500.0, 200.0), 2 * BlobRadius, 30.0, true)");
		
		EventManager:AddEvent(false, 0.1, "PlayerData:SetLookat(TargetEnemy.Controller_)");
		
		EventManager:AddEvent(false, 2.0, "PlayerData:SetLookat(nil)");
		EventManager:AddEvent(false, 2.0, "PlayerData:SetCameraPosition(Vector3D(0.0, -200.0, 50.0), 0.04, true, true)");
		EventManager:AddEvent(false, 2.5, "PlayerData:SetCameraPosition(DefaultCameraVec, DefaultCameraSpeed, DefaultCameraRelative, DefaultCameraFixed)")
		EventManager:AddEvent(false, 2.2, "PlayerData:UnlockPlayer()");
	]])

	SpawnTriggerInfo(LvlLoader:GetInfo("trigger03"), false, false, 
	[[
		EventManager:AddEvent(false, 0.0, "TorchList[7]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[8]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[9]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[10]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[11]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[12]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[13]:ActivateLight()");
	]])

	SpawnTriggerInfo(LvlLoader:GetInfo("trigger04"), false, false, 
	[[
		EventManager:AddEvent(false, 0.0, "TorchList[14]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[15]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[16]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[17]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[18]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[19]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[20]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[21]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[22]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[23]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[1].Pos_, Vector3D( 80.0, 80.0, 170.0), 4.0, 300.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.5, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[1].Pos_, Vector3D(-80.0, 80.0, 170.0), 4.0, 300.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 1.0, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[1].Pos_, Vector3D( 80.0,-80.0, 190.0), 4.0, 300.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 1.5, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[1].Pos_, Vector3D(-80.0,-80.0, 190.0), 4.0, 300.0, BlobRadius, GlobalSpawnController))");
	]])
	--SpawnPoint(Vector3D pos, float interval, float mass, float radius, SpawnController* spawncontrol);
	--void PushSpawn(SpawnPoint point);

	SpawnTriggerInfo(LvlLoader:GetInfo("trigger05"), false, false, 
	[[
		GlobalSpawnController:ClearSpawns();
		EventManager:AddEvent(false, 0.0, "TorchList[24]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[25]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[26]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[27]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[28]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[29]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[2].Pos_, Vector3D(-100.0,  10.0, 150.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.4, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[3].Pos_, Vector3D( 100.0, -10.0, 150.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.8, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[4].Pos_, Vector3D(-100.0,  20.0, 150.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 1.2, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[5].Pos_, Vector3D( 100.0, -20.0, 150.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 1.6, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[6].Pos_, Vector3D(-100.0,  30.0, 150.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
	]])

	SpawnTriggerInfo(LvlLoader:GetInfo("trigger06"), false, false, 
	[[
		GlobalSpawnController:ClearSpawns();
		EventManager:AddEvent(false, 0.0, "TorchList[30]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[31]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[32]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[33]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[34]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[35]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[7].Pos_,  Vector3D(  50.0, -50.0, 180.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.2, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[8].Pos_,  Vector3D(  50.0, -50.0, 180.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.4, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[9].Pos_,  Vector3D( 100.0,   0.0, 180.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.6, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[10].Pos_, Vector3D(-100.0,   0.0, 180.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.8, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[11].Pos_, Vector3D( 100.0,   0.0, 180.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
	]])

	SpawnTriggerInfo(LvlLoader:GetInfo("trigger07"), false, false, 
	[[
		GlobalSpawnController:ClearSpawns();
		EventManager:AddEvent(false, 0.0, "TorchList[36]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[37]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[38]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[39]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[40]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[12].Pos_, Vector3D(   0.0, 100.0, 150.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.2, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[13].Pos_, Vector3D(   0.0, 100.0, 150.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.4, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[14].Pos_, Vector3D(   0.0,  50.0, 190.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.6, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[15].Pos_, Vector3D(   0.0, -50.0, 190.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.8, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[16].Pos_, Vector3D(   0.0,  50.0, 190.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 1.0, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[17].Pos_, Vector3D(   0.0, -50.0, 190.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 1.2, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[18].Pos_, Vector3D(  10.0,  40.0, 190.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 1.4, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[19].Pos_, Vector3D( -20.0,  80.0, 160.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 1.6, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[20].Pos_, Vector3D(  20.0, -80.0, 160.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
	]])

	SpawnTriggerInfo(LvlLoader:GetInfo("trigger08"), false, false, 
	[[
		GlobalSpawnController:ClearSpawns();
		EventManager:AddEvent(false, 0.0, "TorchList[41]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[42]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[43]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[44]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[45]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[46]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[48]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "TorchList[49]:ActivateLight()");
		EventManager:AddEvent(false, 0.0, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[21].Pos_, Vector3D( -20.0,  80.0, 160.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.5, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[22].Pos_, Vector3D(  20.0, -80.0, 160.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 1.0, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[23].Pos_, Vector3D(  20.0, -80.0, 160.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 1.5, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[24].Pos_, Vector3D( -20.0,  80.0, 160.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.0, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[25].Pos_, Vector3D(   0.0,   0.0, 160.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
	]])

	SpawnTriggerInfo(LvlLoader:GetInfo("trigger09"), false, false, 
	[[
		GlobalSpawnController:ClearSpawns();
		EventManager:AddEvent(false, 0.0, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[26].Pos_, Vector3D(  90.0, -10.0, 160.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.3, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[27].Pos_, Vector3D(-100.0,   0.0, 160.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.6, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[28].Pos_, Vector3D( 100.0,   0.0, 160.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 0.9, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[29].Pos_, Vector3D(-100.0,   0.0, 160.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 1.2, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[30].Pos_, Vector3D(-100.0,   0.0, 160.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
		EventManager:AddEvent(false, 1.5, "GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPointList[31].Pos_, Vector3D( 100.0,   0.0, 160.0), 4.0, 30.0, BlobRadius, GlobalSpawnController))");
	]])

	ExplosionRadius = 200.0
	ExplosionMagnitude = 400.0
	SpawnTriggerInfo(LvlLoader:GetInfo("trigger11"), false, false,
	[[
		Info = LvlLoader:GetInfo("explosionSpawn01");
		GlobalSpawnController:CreateExplosion(Info.Pos_, ExplosionRadius, ExplosionMagnitude);
		GlobalSpawnController:SpawnBlobCluster(Info.Pos_, Vector3D( -250.0, -250.0, 50.0), 2 * BlobRadius, 30.0, 5);
	]])
	SpawnTriggerInfo(LvlLoader:GetInfo("trigger12"), false, false,
	[[
		Info = LvlLoader:GetInfo("explosionSpawn02");
		GlobalSpawnController:CreateExplosion(Info.Pos_, ExplosionRadius, ExplosionMagnitude);
		GlobalSpawnController:SpawnBlobCluster(Info.Pos_, Vector3D( 250.0, -250.0, 50.0), 2 * BlobRadius, 30.0, 5);
	]])
	SpawnTriggerInfo(LvlLoader:GetInfo("trigger13"), false, false,
	[[
		Info = LvlLoader:GetInfo("explosionSpawn03");
		GlobalSpawnController:CreateExplosion(Info.Pos_, ExplosionRadius, ExplosionMagnitude);
		GlobalSpawnController:SpawnBlobCluster(Info.Pos_, Vector3D( -250.0, -250.0, 50.0), 2 * BlobRadius, 30.0, 5);
	]])
	SpawnTriggerInfo(LvlLoader:GetInfo("trigger14"), false, false,
	[[
		Info = LvlLoader:GetInfo("explosionSpawn04");
		GlobalSpawnController:CreateExplosion(Info.Pos_, ExplosionRadius, ExplosionMagnitude);
		GlobalSpawnController:SpawnBlobCluster(Info.Pos_, Vector3D( 250.0, -250.0, 50.0), 2 * BlobRadius, 30.0, 5);
	]])
	SpawnTriggerInfo(LvlLoader:GetInfo("trigger15"), false, false,
	[[
		Info = LvlLoader:GetInfo("explosionSpawn05");
		GlobalSpawnController:CreateExplosion(Info.Pos_, ExplosionRadius, ExplosionMagnitude);
		GlobalSpawnController:SpawnBlobCluster(Info.Pos_, Vector3D( -250.0, -250.0, 50.0), 2 * BlobRadius, 30.0, 5);
	]])
	SpawnTriggerInfo(LvlLoader:GetInfo("trigger16"), false, false,
	[[
		Info = LvlLoader:GetInfo("explosionSpawn06");
		GlobalSpawnController:CreateExplosion(Info.Pos_, ExplosionRadius, ExplosionMagnitude);
		GlobalSpawnController:SpawnBlobCluster(Info.Pos_, Vector3D( 250.0, -250.0, 50.0), 2 * BlobRadius, 30.0, 5);
	]])
		
	SpawnTriggerInfo(LvlLoader:GetInfo("trigger17"), false, false,
	[[
		Info = LvlLoader:GetInfo("blockingPlatform01");
		GlobalSpawnController:SpawnPlatform(Info.Pos_, Info.Scale_, Info.Rot_);
		GameEngine.CheckPoint = 1;
	]])

	-- Get player start position
	StartPos = LvlLoader:GetInfo("playerStart01").Pos_
	--StartPos = LvlLoader:GetInfo("playerStart02").Pos_
	
elseif GameEngine.CheckPoint == 1 then

	StartPos = LvlLoader:GetInfo("playerStart03").Pos_
	cameraStartPos = LvlLoader:GetInfo("cameraPosition03").Pos_
	EventManager:AddEvent(false, 0.0, "PlayerData:LockPlayer(Vector3D(0.0, 0.0, 0.0))")
	EventManager:AddEvent(false, 0.0, "PlayerData:SetCameraPosition(Vector3D(0.0, 20.0, 0.0), 0.04, true, true)")
	EventManager:AddEvent(false, 0.0, "TorchList[47]:ActivateLight()")
	EventManager:AddEvent(false, 0.0, "PlayerData:SetEmissiveColor(Vector3D(1.0, 0.0, 0.0), true)")
	EventManager:AddEvent(false, 0.0, "PlayerData:ToggleLight(true)")
	EventManager:AddEvent(false, 0.0, "PlayerData:SetCameraPosition(Vector3D(0.0, -50.0, 25.0), 0.04, true, true)")
	EventManager:AddEvent(false, 0.1, "PlayerData:SetCameraPosition(DefaultCameraVec, DefaultCameraSpeed, DefaultCameraRelative, DefaultCameraFixed)")
	EventManager:AddEvent(false, 0.0, "PlayerData:SetRimColor(Vector3D(0.0, 0.3, 1.0), 1.0)")
	EventManager:AddEvent(false, 0.5, "PlayerData:UnlockPlayer()")
	
	BlockingInfo = LvlLoader:GetInfo("blockingPlatform01");
	GlobalSpawnController:SpawnPlatform(BlockingInfo.Pos_, BlockingInfo.Scale_, BlockingInfo.Rot_);
	
	for i = 11, 11 do
		local lavaName = "lavaPool"
		
		if i < 10 then
			lavaName = lavaName .. 0 .. i	
		else
			lavaName = lavaName .. i
		end
		
		Info = LvlLoader:GetInfo(lavaName)
		
		GlobalSpawnController:SpawnLavaPool(Info.Pos_, Info.Scale_, Info.Rot_, 250.0, 1000.0)
	end
		
	local NumberOfPlatforms = 30
	PlatformList = {}
	for i = 1, NumberOfPlatforms do
		local platformName = "platform"
		
		if i < 10 then
			platformName = platformName .. 0 .. i
		else
			platformName = platformName .. i
		end
		
		Info = LvlLoader:GetInfo(platformName)
		PlatformList[i] =	GlobalSpawnController:SpawnPlatform2(Info.Pos_, Info.Scale_, Info.Rot_)
	end
end

SpawnTriggerInfo(LvlLoader:GetInfo("trigger02"), false, false,
[[
	Info = LvlLoader:GetInfo("risingLava01");
	PlayerData:ShakeCamera(3.0, 3.0, 6.0);
	EventManager:AddEvent(false, 2.0, "GlobalSpawnController:SpawnRisingLava(Info.Pos_, Info.Scale_, Info.Rot_, Vector3D(0.0, 0.0, 10.0), 0.0022)");
]])

SpawnTriggerInfo(LvlLoader:GetInfo("trigger19"), false, false,
[[
	PlayerData:LockPlayer(Vector3D(0.0, 1.0, 0.0));
	EventManager:AddEvent(false, 1.5, "GameEngine.FirstRun = true; GameEngine.CurrentLevelNum_ = 2; GameEngine.GameOver = true");
]])

TorchList = {}
for i = 50, 93 do
	local torchName = "torch"
	
	if i < 10 then
		torchName = torchName .. 0 .. i
	else
		torchName = torchName .. i
	end
	
	Info = LvlLoader:GetInfo(torchName)
	TorchList[i] =	GlobalSpawnController:SpawnTorch(Info.Pos_, Info.Scale_, Info.Rot_, Vector3D(0.2, 0.2, 1.5), 1.2, 40.0, true)
end

MinZ = -1000.0
KillsNeeded = 0