Added lua scripts for the sunrise.

This commit is contained in:
SteffenFuendgens 2015-03-05 18:30:50 +01:00
parent 2dd09aff19
commit 0f7240b047
4 changed files with 60 additions and 1 deletions

View File

@ -2,6 +2,10 @@ local global = require( "global" )
if(global.triggeredSCRIPTNAME == nil) then if(global.triggeredSCRIPTNAME == nil) then
global.triggeredSCRIPTNAME = false global.triggeredSCRIPTNAME = false
end end
if(global.triggeredSCRIPTNAMEUndo == nil) then
global.triggeredSCRIPTNAMEUndo = false
end
function trigger(objectToChange) function trigger(objectToChange)
if(global.triggeredSCRIPTNAME == false) then if(global.triggeredSCRIPTNAME == false) then
if(not level) then if(not level) then
@ -15,3 +19,17 @@ function trigger(objectToChange)
print("SCRIPTNAME") print("SCRIPTNAME")
end end
end end
function triggerUndo(objectToChange)
if(global.triggeredSCRIPTNAMEUndo == false) then
if(not level) then
print("No level found in Lua!")
return
end
--enter the scripts undo code here
global.triggeredSCRIPTNAMEUndo = true
print("SCRIPTNAMEUndo")
end
end

View File

@ -2,12 +2,14 @@ local global = require( "global" )
if(global.triggeredResetPlayer == nil) then if(global.triggeredResetPlayer == nil) then
global.triggeredResetPlayer = false global.triggeredResetPlayer = false
end end
function trigger(objectToChange) function trigger(objectToChange)
if(global.triggeredResetPlayer == false) then if(global.triggeredResetPlayer == false) then
if(not level) then if(not level) then
print("No level found in Lua!") print("No level found in Lua!")
return return
end end
if(global.triggeredOpenFirstDoor == true) then if(global.triggeredOpenFirstDoor == true) then
if(global.openedSecondDoor == true) then if(global.openedSecondDoor == true) then
if(global.triggeredOpenThirdDoor == true) then if(global.triggeredOpenThirdDoor == true) then
@ -22,7 +24,6 @@ function trigger(objectToChange)
level:resetPlayer() level:resetPlayer()
end end
--global.triggeredResetPlayer = true
print("reset player") print("reset player")
end end
end end

View File

@ -0,0 +1,19 @@
local global = require( "global" )
if(global.triggeredSunStart == nil) then
global.triggeredSunStart = false
end
function trigger(objectToChange)
if(global.triggeredSunStart == false) then
if(not level) then
print("No level found in Lua!")
return
end
local time = os.clock()
global.sunStartTime = time
global.triggeredSunStart = true
print("sunStart")
end
end

View File

@ -0,0 +1,21 @@
local global = require( "global" )
function trigger(objectToChange)
if(global.triggeredSunStart) then
if(not level) then
print("No level found in Lua!")
return
end
local maxTimeDiff = 5
local timeDiff = os.clock()- global.sunStartTime
if(timeDiff > maxTimeDiff)then
timeDiff = maxTimeDiff
end
timeDiff = timeDiff/maxTimeDiff
local x = 1 - 0.3 * timeDiff
local y = 0.7 * timeDiff
local z = timeDiff^0.5 * 0.6 -0.1
level:setSunAngle(x,y,z)
end
end