Merge branch 'master' of github.com:Faerbit/swp

This commit is contained in:
Faerbit 2015-03-07 14:36:12 +01:00
commit 7e6b5df51c
6 changed files with 48 additions and 0 deletions

View File

@ -25,6 +25,11 @@ function trigger(objectToChange)
global.triggeredOpenSecondDoor1Undo = false
end
local xPos = -6.5
local yPos = 25.0
local zPos = 54.5
level:preloadLightPosition(xPos, yPos, zPos)
level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -1.5, 3.0, 0.8)
print("openSecondDoor1")
end
end
@ -41,6 +46,7 @@ function triggerUndo(objectToChange)
global.triggeredOpenSecondDoor2 = false
global.triggeredOpenSecondDoor3 = false
global.triggeredOpenSecondDoor4 = false
level:deleteFourLights()
global.triggeredOpenSecondDoor1Undo = true
print("openSecondDoor1Undo")

View File

@ -25,6 +25,11 @@ function trigger(objectToChange)
global.triggeredOpenSecondDoor2Undo = false
end
local xPos = -53.5
local yPos = 25.0
local zPos = 26.5
level:preloadLightPosition(xPos, yPos, zPos)
level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -1.5, 3.0, 0.8)
print("openSecondDoor2")
end
end
@ -41,6 +46,7 @@ function triggerUndo(objectToChange)
global.triggeredOpenSecondDoor2 = false
global.triggeredOpenSecondDoor3 = false
global.triggeredOpenSecondDoor4 = false
level:deleteFourLights()
global.triggeredOpenSecondDoor2Undo = true
print("openSecondDoor2Undo")

View File

@ -25,6 +25,11 @@ function trigger(objectToChange)
global.triggeredOpenSecondDoor3Undo = false
end
local xPos = -6.5
local yPos = 25.0
local zPos = 26.5
level:preloadLightPosition(xPos, yPos, zPos)
level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -1.5, 3.0, 0.8)
print("openSecondDoor3")
end
end
@ -41,6 +46,7 @@ function triggerUndo(objectToChange)
global.triggeredOpenSecondDoor2 = false
global.triggeredOpenSecondDoor3 = false
global.triggeredOpenSecondDoor4 = false
level:deleteFourLights()
global.triggeredOpenSecondDoor3Undo = true
print("openSecondDoor3Undo")

View File

@ -34,6 +34,11 @@ function trigger(objectToChange)
end
end
local xPos = -53.5
local yPos = 25.0
local zPos = 54.5
level:preloadLightPosition(xPos, yPos, zPos)
level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -1.5, 3.0, 0.8)
print("openSecondDoor4")
end
end
@ -50,6 +55,7 @@ function triggerUndo(objectToChange)
global.triggeredOpenSecondDoor2 = false
global.triggeredOpenSecondDoor3 = false
global.triggeredOpenSecondDoor4 = false
level:deleteFourLights()
global.triggeredOpenSecondDoor4Undo = true
print("openSecondDoor4Undo")

View File

@ -43,6 +43,9 @@ void Level::load() {
.addFunction("setSunDirection", &Level::setSunDirection)
.addFunction("forceMove", &Level::forceMove)
.addFunction("activateEndgame", &Level::activateEndgame)
.addFunction("preloadLightPosition", &Level::preloadLightPosition)
.addFunction("addLightByParameters", &Level::addLightByParameters)
.addFunction("deleteFourLights", &Level::deleteFourLights)
.endClass();
//Push the level to Lua as a global variable
luabridge::push(luaState, this);
@ -259,6 +262,23 @@ void Level::addLight(Light light) {
this->lights.push_back(light);
}
void Level::preloadLightPosition(float xPos, float yPos, float zPos){
nextLightPosition = glm::vec3(xPos, yPos, zPos);
}
void Level::addLightByParameters(float redColour, float greenColour, float blueColour, float intensity, float flameYOffset, float flameHeight, float flameWidth){
glm::vec3 colour = glm::vec3(redColour, greenColour, blueColour);
this->lights.push_back(Light(nextLightPosition, colour, intensity, flameYOffset, flameHeight, flameWidth));
}
void Level::deleteFourLights(){
int indice = lights.size()-4;
lights.erase(lights.begin() + indice);
lights.erase(lights.begin() + indice);
lights.erase(lights.begin() + indice);
lights.erase(lights.begin() + indice);
}
void Level::addTrigger(Trigger trigger) {
this->triggers.push_back(trigger);
}

View File

@ -55,6 +55,9 @@ class Level {
unsigned int getPhysicsObjectsVectorSize();
void setCameraCenter(Object* object);
void addLight(Light light);
void preloadLightPosition(float xPos, float yPos, float zPos);
void addLightByParameters(float redColour, float greenColour, float blueColour, float intensity, float flameYOffset, float flameHeight, float flameWidth);
void deleteFourLights();
void addTrigger(Trigger trigger);
lua_State* getLuaState();
Terrain* getTerrain();
@ -81,6 +84,7 @@ class Level {
float skydomeSize;
float strength;
std::string xmlFilePath;
glm::vec3 nextLightPosition;
};
#endif