
--StartPos = Vector3D:new(0.0, 0.0, 1500.0)
StartPos = LvlLoader:GetInfo("playerStart01").Pos_

bridgePiece01 = LvlLoader:GetInfo("bridgePiece01")
bridgePiece02 = LvlLoader:GetInfo("bridgePiece02")
bridgePiece03 = LvlLoader:GetInfo("bridgePiece03")
bridgePiece04 = LvlLoader:GetInfo("bridgePiece04")
bridgePiece05 = LvlLoader:GetInfo("bridgePiece05")
bridgePiece06 = LvlLoader:GetInfo("bridgePiece06")
bridgePiece07 = LvlLoader:GetInfo("bridgePiece07")
bridgePiece08 = LvlLoader:GetInfo("bridgePiece08")
bridgePiece09 = LvlLoader:GetInfo("bridgePiece09")

-- Spawn dummy bridge pieces
--Object* SpawnBlock(Vector3D pos, Vector3D vel, Vector3D scale, Vector3D rot, float mass = 200.0f, bool Sleep = false, int blocktype = TypeBlock, int level = 0);

-- Spawn bridge pieces
bridgePiece01 = SpawnTowerInfo(bridgePiece01, true, true)
bridgePiece02 = SpawnTowerInfo(bridgePiece02, false, true)
bridgePiece03 = SpawnTowerInfo(bridgePiece03, false, true)
bridgePiece04 = SpawnTowerInfo(bridgePiece04, false, true)
bridgePiece05 = SpawnTowerInfo(bridgePiece05, false, true)
bridgePiece06 = SpawnTowerInfo(bridgePiece06, false, true)
bridgePiece07 = SpawnTowerInfo(bridgePiece07, false, true)
bridgePiece08 = SpawnTowerInfo(bridgePiece08, true, true)
bridgePiece09 = SpawnTowerInfo(bridgePiece09, false, true)

--function SpawnTriggerInfo(Info, Script, VisualFlag, FileFlag)
--SpawnRockInfo(LvlLoader:GetInfo("rock05"), Vector3D:new(0.0, 0.0, 0.0))

-- Get Rock info
rock05 = LvlLoader:GetInfo("rock05")
rock07 = LvlLoader:GetInfo("rock07")
rock08 = LvlLoader:GetInfo("rock08")
rock09 = LvlLoader:GetInfo("rock09")
rock10 = LvlLoader:GetInfo("rock10")
rock11 = LvlLoader:GetInfo("rock11")
rock12 = LvlLoader:GetInfo("rock12")
rock13 = LvlLoader:GetInfo("rock13")

rock15 = LvlLoader:GetInfo("rock15")
rock16 = LvlLoader:GetInfo("rock16")
rock17 = LvlLoader:GetInfo("rock17")
rock18 = LvlLoader:GetInfo("rock18")
rock19 = LvlLoader:GetInfo("rock19")
rock20 = LvlLoader:GetInfo("rock20")
rock21 = LvlLoader:GetInfo("rock21")
rock22 = LvlLoader:GetInfo("rock22")
rock23 = LvlLoader:GetInfo("rock23")
rock24 = LvlLoader:GetInfo("rock24")
rock25 = LvlLoader:GetInfo("rock25")
rock26 = LvlLoader:GetInfo("rock26")
rock27 = LvlLoader:GetInfo("rock27")
rock28 = LvlLoader:GetInfo("rock28")
rock29 = LvlLoader:GetInfo("rock29")
rock30 = LvlLoader:GetInfo("rock30")
rock31 = LvlLoader:GetInfo("rock31")

--void AddEvent(bool type, float t, char* file);

-- spawn triggers and what they do when the go off
FallVelocity = Vector3D(-100.0, -100.0, -500.0)

SpawnTriggerInfo(LvlLoader:GetInfo("trigger05"), true, false, 
[[
	print("trigger05 -> rock05, rock07")
	bridgePiece02:InsertIntoWorld();
	EventManager:AddEvent(false, 0.6, "SpawnRockInfo(rock05, FallVelocity)");
	EventManager:AddEvent(false, 0.6, "SpawnRockInfo(rock07, FallVelocity * -1)")
]])

SpawnTriggerInfo(LvlLoader:GetInfo("trigger07"), true, false, 
[[
	print("trigger07 -> rock08, rock13")
	bridgePiece03:InsertIntoWorld();
	EventManager:AddEvent(false, 0.0, "SpawnRockInfo(rock08, FallVelocity)");
	EventManager:AddEvent(false, 0.5, "SpawnRockInfo(rock13, FallVelocity)");
]])

SpawnTriggerInfo(LvlLoader:GetInfo("trigger08"), true, false, 
[[
	print("trigger08 -> rock12, rock09, rock11");
	bridgePiece03:InsertIntoWorld();
	EventManager:AddEvent(false, 0.0, "SpawnRockInfo(rock12, FallVelocity)");
	EventManager:AddEvent(false, 0.6, "SpawnRockInfo(rock09, FallVelocity)");
	EventManager:AddEvent(false, 0.6, "SpawnRockInfo(rock11, FallVelocity)");
]])

SpawnTriggerInfo(LvlLoader:GetInfo("trigger09"), true, false, 
[[
	print("trigger09 -> rock10, rock11");
	bridgePiece03:InsertIntoWorld();
	EventManager:AddEvent(false, 0.0, "SpawnRockInfo(rock10, FallVelocity)");
	EventManager:AddEvent(false, 0.6, "SpawnRockInfo(rock11, FallVelocity)");
]])

SpawnTriggerInfo(LvlLoader:GetInfo("trigger10"), true, false, 
[[
	print("trigger10 -> rock15, rock17");
	bridgePiece04:InsertIntoWorld();
	EventManager:AddEvent(false, 0.0, "SpawnRockInfo(rock15, FallVelocity)");
	EventManager:AddEvent(false, 0.6, "SpawnRockInfo(rock17, FallVelocity)");
]])

SpawnTriggerInfo(LvlLoader:GetInfo("trigger11"), true, false, 
[[
	print("trigger11 -> rock19, rock16, rock18");
	bridgePiece04:InsertIntoWorld();
	EventManager:AddEvent(false, 0.0, "SpawnRockInfo(rock19, FallVelocity)");
	EventManager:AddEvent(false, 0.6, "SpawnRockInfo(rock16, FallVelocity)");
	EventManager:AddEvent(false, 2.0, "SpawnRockInfo(rock18, FallVelocity)");
]])

SpawnTriggerInfo(LvlLoader:GetInfo("trigger12"), true, false, 
[[
	print("trigger12 -> rock21, rock20");
	bridgePiece04:InsertIntoWorld();
	EventManager:AddEvent(false, 0.05, "SpawnRockInfo(rock21, FallVelocity)");
	EventManager:AddEvent(false, 1.0, "SpawnRockInfo(rock20, FallVelocity)");
]])

SpawnTriggerInfo(LvlLoader:GetInfo("trigger13"), true, false, 
[[
	print("trigger13 -> rock22, rock23, rock24, rock25");
	bridgePiece05:InsertIntoWorld();
	EventManager:AddEvent(false, 0.0, "SpawnRockInfo(rock22, FallVelocity)");
	EventManager:AddEvent(false, 0.4, "SpawnRockInfo(rock23, FallVelocity)");
	EventManager:AddEvent(false, 1.0, "SpawnRockInfo(rock24, FallVelocity)");
	EventManager:AddEvent(false, 1.2, "SpawnRockInfo(rock25, FallVelocity)");
]])

SpawnTriggerInfo(LvlLoader:GetInfo("trigger14"), true, false, 
[[
	print("trigger14 -> rock26, rock27, rock28");
	bridgePiece06:InsertIntoWorld();
	EventManager:AddEvent(false, 0.0, "SpawnRockInfo(rock26, FallVelocity)");
	EventManager:AddEvent(false, 0.8, "SpawnRockInfo(rock27, FallVelocity)");
	EventManager:AddEvent(false, 0.8, "SpawnRockInfo(rock28, FallVelocity)");
]])

SpawnTriggerInfo(LvlLoader:GetInfo("trigger15"), true, false, 
[[
	print("trigger15 -> rock29, rock30, rock31");
	bridgePiece07:InsertIntoWorld();
	bridgePiece09:InsertIntoWorld();
	EventManager:AddEvent(false, 0.1, "SpawnRockInfo(rock29, FallVelocity)");
	EventManager:AddEvent(false, 0.1, "SpawnRockInfo(rock30, FallVelocity)");
	EventManager:AddEvent(false, 1.0, "SpawnRockInfo(rock31, FallVelocity)");
]])


-- SpawnTriggers

MinZ = 50.0
KillsNeeded = 0

function Update(killcount)
	KillCount = killcount
end