--L1_Elevator-- Loading = {} NextLoad = {} NextLoad2 = {} loadFlag = false loadFlag2 = false loadFlag3 = false ---Loading State----- Loading["Enter"] = function(actor) print("Enterting Start Function") end Loading["Update"] = function(actor) if loadFlag == false then print("Enterting Start Function") tank = GAME():GetSceneSystem():GetCurrentScene():FindActor("Tank") --Set Tank's new position. if tank then tank:SetTranslation(9.0, -23.0, 2.0) end if GAME():GetSceneSystem():GetIsLoading() == false then GAME():GetSceneSystem():Load("L1_Hallway_Start.xml") loadFlag = true else print("[Lua] Scene system is busy") end end if GAME():GetSceneSystem():GetIsLoading() == false then actor:GetStateMachine():ChangeState(NextLoad) print("[Lua] Leaving this state. Entering NextLoad State. Done Loading Hallway.") end end Loading["Exit"] = function(actor) end NextLoad["Enter"] = function(actor) end NextLoad["Update"] = function(actor) if loadFlag2 == false then print("Entering Start Function") if GAME():GetSceneSystem():GetIsLoading() == false then GAME():GetSceneSystem():Load("L1_BrainBugRoom.xml") GAME():GetSceneSystem():Unload("L1_HallwayStart.xml") if not GAME():GetSceneSystem():GetScene("L1_MineShaft.xml") then print("Successfully unloaded MineShaft.") end loadFlag2 = true print("[Lua] Leaving this state. Entering NextLoad State. Done Loading BugRoom.") else print("[Lua] Scene system is busy") end end if GAME():GetSceneSystem():GetIsLoading() == false then actor:GetStateMachine():ChangeState(NextLoad2) end end NextLoad["Exit"] = function(actor) end NextLoad2["Enter"] = function(actor) end NextLoad2["Update"] = function(actor) if loadFlag3 == false then print("Entering Start Function") if GAME():GetSceneSystem():GetIsLoading() == false then GAME():GetSceneSystem():Load("L1_Warehouse.xml") print("[Lua] Leaving this state. Entering NextLoad State. Done Loading Warehouse.") loadFlag3 = true else print("[Lua] Scene system is busy") end end end NextLoad2["Exit"] = function(actor) end