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

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

--print("CaveLevel_Init.lua")

cameraStartPos = 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.0, "PlayerData:LockPlayer(Vector3D(0.0, 0.0, 0.0))")
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, 1.0, "PlayerData:SetRimColor(Vector3D(0.0, 0.3, 1.0), 1.0)")
EventManager:AddEvent(false, 1.0, "PlayerData:UnlockPlayer()")
EventManager:AddEvent(false, 0.0, "PlayerData.MaxDamage_ = 300.0")

StartPlatform = SpawnPlatformInfo(LvlLoader:GetInfo("platform01"))

-- Get player start position

for i = 1, 84 do
	local lavaName = "lavaFlow"
	
	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_, 200.0, 100.0)
end

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

GameEngine.CheckPoint = 0

if GameEngine.CheckPoint == 0 then
	StartPos = LvlLoader:GetInfo("playerStart01").Pos_;
	GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPoints[1].Pos_, Vector3D(-70.0, -70.0, 20.0), 0.5, 50.0, 0.0, GlobalSpawnController, SpawnPoints[1].Scale_, 19))
elseif GameEngine.CheckPoint == 1 then
	StartPos = LvlLoader:GetInfo("playerStart02").Pos_;
	GlobalSpawnController:PushSpawn(SpawnPoint(SpawnPoints[2].Pos_, Vector3D(0.0, 0.0, 0.0), 0.5, 50.0, 0.0, GlobalSpawnController, SpawnPoints[2].Scale_, 19))
elseif GameEngine.CheckPoint == 2 then
	
end

--SpawnPoint(Vector3D pos, Vector3D vel, float interval, float mass, float radius, SpawnController* spawncontrol, Vector3D scale = Vector3D(0.0f, 0.0f, 0.0f), int type = TypeEnemy);

if GameEngine.CheckPoint == 0 then
	SpawnTriggerInfo(LvlLoader:GetInfo("checkPoint01"), false, false, 
	[[
		GameEngine.CheckPoint = 1;
	]])
end

MinZ = -100000.0
KillsNeeded = 0