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

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

--print("PlatformTestLevel_Init.lua")

StartPos = LvlLoader:GetInfo("playerStart01").Pos_

cameraStartPosition01 = LvlLoader:GetInfo("cameraStartPosition01")
cameraStartTarget01 = LvlLoader:GetInfo("cameraStartTarget01")
cameraStartPosition02 = LvlLoader:GetInfo("cameraStartPosition02")
cameraStartTarget02 = LvlLoader:GetInfo("cameraStartTarget02")
cameraStartPos = cameraStartPosition01.Pos_;

Sound:StopMusic();

EventManager:AddEvent(false, 0.0, "PlayerData:SetEmissiveColor(Vector3D(0.0, 0.0, 0.0), true)")
EventManager:AddEvent(false, 0.0, "PlayerData:ToggleLight(false)")
EventManager:AddEvent(false, 0.0, "PlayerData:SetRimColor(Vector3D(0.0, 0.0, 0.0), 0.0)")
EventManager:AddEvent(false, 0.0, "PlayerData.MoveSpeed_ = 350.0");
EventManager:AddEvent(false, 0.0, "PlayerData.Acceleration_ = 5.0");


EventManager:AddEvent(false, 0.0, "PlayerData:LockPlayer(Vector3D(0.0, 0.0, 0.0))")
EventManager:AddEvent(false, 0.0, "PlayerData:SetCameraPositionLookat(cameraStartPosition01.Pos_, cameraStartTarget01.Pos_, 1.0)")
EventManager:AddEvent(false, 0.5, "PlayerData:SetCameraPositionLookat(cameraStartPosition02.Pos_, cameraStartTarget02.Pos_, 0.03)")

EventManager:AddEvent(false, 4.0, "PlayerData:SetEmissiveColor(Vector3D(100.0, 0.0, 0.0), true)")
EventManager:AddEvent(false, 4.1, "PlayerData:SetEmissiveColor(Vector3D(0.0, 0.0, 0.0), false)")
EventManager:AddEvent(false, 4.4, "PlayerData:SetEmissiveColor(Vector3D(100.0, 0.0, 0.0), true)")
EventManager:AddEvent(false, 4.6, "PlayerData:SetEmissiveColor(Vector3D(0.0, 0.0, 0.0), false)")
EventManager:AddEvent(false, 5.0, "PlayerData:SetEmissiveColor(Vector3D(100.0, 0.0, 0.0), true)")
EventManager:AddEvent(false, 5.0, "Sound:PlayMusic(\"TreasureRoomMusic\")")
EventManager:AddEvent(false, 4.4, "PlayerData:ToggleLight(true)")
EventManager:AddEvent(false, 5.0, "PlayerData:SetRimColor(Vector3D(0.0, 0.3, 1.5), 1.0)")

EventManager:AddEvent(false, 6.5, "PlayerData:SetCameraPosition(Vector3D(-75.0,  0.0, 10.0), 0.03, true, true)");
EventManager:AddEvent(false, 6.6, "PlayerData:SetCameraPosition(Vector3D(-50.0,-50.0, 15.0), 0.03, true, true)");
EventManager:AddEvent(false, 6.7, "PlayerData:SetCameraPosition(Vector3D(  0.0,-75.0, 20.0), 0.03, true, true)");
EventManager:AddEvent(false, 6.8, "PlayerData:SetCameraPosition(DefaultCameraVec, DefaultCameraSpeed, DefaultCameraRelative, DefaultCameraFixed)")
EventManager:AddEvent(false, 7.5, "PlayerData:UnlockPlayer()")



--EventManager:AddEvent(false, 8.0, "PlayerData:SetCameraPosition(Vector3D(-200.0, 0.0, 100.0), 0.3, true, true)");
--EventManager:AddEvent(false, 7.0, "PlayerData:SetCameraPosition(DefaultCameraVec, DefaultCameraSpeed, DefaultCameraRelative, DefaultCameraFixed)")

SpawnTowerInfo(LvlLoader:GetInfo("floor01"), true, true)


cameraPosition01 = LvlLoader:GetInfo("cameraPosition01")
cameraTarget01 = LvlLoader:GetInfo("cameraTarget01")
SpawnTriggerInfo(LvlLoader:GetInfo("floorTrigger01"), false, false, 
[[
	PlayerData:LockPlayer(Vector3D(0.0, 0.0, 0.0));
	PlayerData:SetCameraPositionLookat(cameraPosition01.Pos_, cameraTarget01.Pos_, 0.03);
	PlayerData:ShakeCamera(5.0, 3.0, 3.0);
	SpawnDoomWallInfo(LvlLoader:GetInfo("doomWall01"));
	Sound:StopMusic();
	Sound:PlayMusic("CaveMusic");
	EventManager:AddEvent(false, 2.8, "Sound:PlayEvent(\"BridgeExplosion\", LvlLoader:GetInfo(\"floorTrigger01\").Pos_, Vector3D(0.0, 0.0, 0.0), true, true)");
]])

SpawnTriggerInfo(LvlLoader:GetInfo("nextLevelTrigger01"), false, false, 
[[
	GameEngine.CurrentLevelNum_ = 1;
	GameEngine.GameOver = true;
	GameEngine.FirstRun = true;
]])

Totem01 = LvlLoader:GetInfo("totem01")
GlobalSpawnController:SpawnGenericObject(Totem01.Pos_, Totem01.Scale_, Totem01.Rot_, "meshes/terrain/Statue.x", "materials/statue.mat", 1.0);

for i = 1, 96 do

	local Name = "lua"
	
	if i < 10 then
		Name = Name .. 0 .. i
	else
		Name = Name .. i
	end
	
	local Info = LvlLoader:GetInfo(Name)
	
	GlobalSpawnController:SpawnGenericObject(Info.Pos_, Info.Scale_, Info.Rot_, "meshes/terrain/vase.x", "materials/temple.mat", 0.2);

end

for i = 1, 8 do

	local Name = "tower"
	
	if i < 10 then
		Name = Name .. 0 .. i
	else
		Name = Name .. i
	end
	
	local Info = LvlLoader:GetInfo(Name)
	
	SpawnTowerInfo(Info, true, false)

end


MinZ = -1000.0
KillsNeeded = 0