Added brick models and Lifebuoy balance changes
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
# Blender MTL File: 'Bricks.blend'
|
||||||
|
# Material Count: 1
|
||||||
|
|
||||||
|
newmtl Material.004
|
||||||
|
Ns 96.078431
|
||||||
|
Ka 0.000000 0.000000 0.000000
|
||||||
|
Kd 0.640000 0.640000 0.640000
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ni 1.000000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
map_Kd LifebuoyTexture.png
|
||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 122 B |
@@ -0,0 +1,12 @@
|
|||||||
|
# Blender MTL File: 'Bricks.blend'
|
||||||
|
# Material Count: 1
|
||||||
|
|
||||||
|
newmtl Material.004
|
||||||
|
Ns 96.078431
|
||||||
|
Ka 0.000000 0.000000 0.000000
|
||||||
|
Kd 0.640000 0.640000 0.640000
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ni 1.000000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
map_Kd StickyTexture.png
|
||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 122 B |
@@ -61,6 +61,7 @@ private:
|
|||||||
|
|
||||||
float m_LeftEdge = -3.8f;
|
float m_LeftEdge = -3.8f;
|
||||||
float m_RightEdge = 3.8f;
|
float m_RightEdge = 3.8f;
|
||||||
|
float m_DownEdge = -9.2f;
|
||||||
std::list<LifeBuoyInfo> m_LifeBuoys;
|
std::list<LifeBuoyInfo> m_LifeBuoys;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -198,11 +198,11 @@ void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBe
|
|||||||
} else if (typeInt == LifebuoyBrick) {
|
} else if (typeInt == LifebuoyBrick) {
|
||||||
cBrick->Type = LifebuoyBrick;
|
cBrick->Type = LifebuoyBrick;
|
||||||
auto model = m_World->GetComponent<Components::Model>(brick);
|
auto model = m_World->GetComponent<Components::Model>(brick);
|
||||||
model->Color = glm::vec4(1.f, 0.f, 0.f, .0f);
|
model->ModelFile = "Models/Brick/LifeBuoyBrick.obj";
|
||||||
} else if (typeInt == StickyBrick) {
|
} else if (typeInt == StickyBrick) {
|
||||||
cBrick->Type = StickyBrick;
|
cBrick->Type = StickyBrick;
|
||||||
auto model = m_World->GetComponent<Components::Model>(brick);
|
auto model = m_World->GetComponent<Components::Model>(brick);
|
||||||
model->Color = glm::vec4(0.f, 0.f, 1.f, .0f);
|
model->ModelFile = "Models/Brick/StickyBrick.obj";
|
||||||
}
|
}
|
||||||
float x = line * spacesBetweenBricks.x;
|
float x = line * spacesBetweenBricks.x;
|
||||||
float y = row * spacesBetweenBricks.y;
|
float y = row * spacesBetweenBricks.y;
|
||||||
|
|||||||
@@ -45,18 +45,27 @@ void dd::Systems::LifebuoySystem::Update(double dt)
|
|||||||
{
|
{
|
||||||
for (auto it = m_LifeBuoys.begin(); it != m_LifeBuoys.end();) {
|
for (auto it = m_LifeBuoys.begin(); it != m_LifeBuoys.end();) {
|
||||||
it->TimeToLive -= dt;
|
it->TimeToLive -= dt;
|
||||||
if (it->TimeToLive < 0.f) {
|
auto transformComponent = m_World->GetComponent<Components::Transform>(it->Entity);
|
||||||
|
|
||||||
|
if (transformComponent->Position.y < m_DownEdge) {
|
||||||
m_World->RemoveEntity(it->Entity);
|
m_World->RemoveEntity(it->Entity);
|
||||||
m_LifeBuoys.erase(it++);
|
m_LifeBuoys.erase(it++);
|
||||||
|
LOG_INFO("Removed buoy");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
auto transformComponent = m_World->GetComponent<Components::Transform>(it->Entity);
|
|
||||||
|
|
||||||
if (transformComponent->Position.x > m_RightEdge) {
|
if (transformComponent->Position.x > m_RightEdge) {
|
||||||
transformComponent->Position = glm::vec3(m_LeftEdge + 0.1f, transformComponent->Position.y, transformComponent->Position.z);
|
transformComponent->Position = glm::vec3(m_LeftEdge + 0.1f, transformComponent->Position.y, transformComponent->Position.z);
|
||||||
}
|
} else if (transformComponent->Position.x < m_LeftEdge) {
|
||||||
else if (transformComponent->Position.x < m_LeftEdge) {
|
|
||||||
transformComponent->Position = glm::vec3(m_RightEdge - 0.1f, transformComponent->Position.y, transformComponent->Position.z);
|
transformComponent->Position = glm::vec3(m_RightEdge - 0.1f, transformComponent->Position.y, transformComponent->Position.z);
|
||||||
|
} else if (it->TimeToLive < 0.f) {
|
||||||
|
auto physicsComponent = m_World->GetComponent<Components::Physics>(it->Entity);
|
||||||
|
physicsComponent->Mask = CollisionLayer::Type::LifeBuoy;
|
||||||
|
physicsComponent->GravityScale = 10.f;
|
||||||
|
|
||||||
|
auto modelComponent = m_World->GetComponent<Components::Model>(it->Entity);
|
||||||
|
modelComponent->Color = glm::vec4(0.5f, 0.5f, 0.5f, 0.f);
|
||||||
|
LOG_INFO("Buoy is sinking");
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
@@ -101,7 +110,7 @@ bool dd::Systems::LifebuoySystem::OnLifebuoy(const dd::Events::Lifebuoy &event)
|
|||||||
auto transform = m_World->GetComponent<Components::Transform>(ent);
|
auto transform = m_World->GetComponent<Components::Transform>(ent);
|
||||||
auto physics = m_World->GetComponent<Components::Physics>(ent);
|
auto physics = m_World->GetComponent<Components::Physics>(ent);
|
||||||
physics->CollisionType = CollisionType::Type::Dynamic;
|
physics->CollisionType = CollisionType::Type::Dynamic;
|
||||||
transform->Position = glm::vec3(event.Transform->Position.x, transform->Position.y + 2.f, -10.f);
|
transform->Position = glm::vec3(0.f, 0.f, -10.f);
|
||||||
transform->Velocity = glm::vec3(20.f, 3.f, 0.f);
|
transform->Velocity = glm::vec3(20.f, 3.f, 0.f);
|
||||||
LifeBuoyInfo info;
|
LifeBuoyInfo info;
|
||||||
info.Entity = ent;
|
info.Entity = ent;
|
||||||
|
|||||||
Reference in New Issue
Block a user