Merge branch 'master' of github.com:sippeangelo/Escape-the-Dawn
Conflicts: Escape-the-Dawn/Systems/PlayerSystem.cpp
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -70,7 +70,6 @@ void Systems::CollisionSystem::Intersects(EntityID aEntity, EntityID bEntity)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auto transformSystem = m_World->GetSystem<Systems::TransformSystem>("TransformSystem");
|
auto transformSystem = m_World->GetSystem<Systems::TransformSystem>("TransformSystem");
|
||||||
|
|
||||||
auto aBounds = m_World->GetComponent<Components::Bounds>(aEntity, "Bounds");
|
auto aBounds = m_World->GetComponent<Components::Bounds>(aEntity, "Bounds");
|
||||||
auto bBounds = m_World->GetComponent<Components::Bounds>(bEntity, "Bounds");
|
auto bBounds = m_World->GetComponent<Components::Bounds>(bEntity, "Bounds");
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,6 @@ void Systems::CollisionSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
transform->Position[0] += parentTransform->Position[0];
|
transform->Position[0] += parentTransform->Position[0];
|
||||||
transform->Position[1] += parentTransform->Position[1];
|
transform->Position[1] += parentTransform->Position[1];
|
||||||
transform->Position[2] += parentTransform->Position[2];
|
transform->Position[2] += parentTransform->Position[2];
|
||||||
<<<<<<< HEAD
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
auto collisionComponent = m_World->GetComponent<Components::Collision>(entity, "Collision");
|
auto collisionComponent = m_World->GetComponent<Components::Collision>(entity, "Collision");
|
||||||
@@ -26,7 +23,6 @@ void Systems::CollisionSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
// Quit out if we're not interested in collision events
|
// Quit out if we're not interested in collision events
|
||||||
if (!collisionComponent->Interested)
|
if (!collisionComponent->Interested)
|
||||||
return;
|
return;
|
||||||
>>>>>>> f76c0b336f87a259a7eabf3c532fc885f155a605
|
|
||||||
|
|
||||||
auto entities = m_World->GetEntities();
|
auto entities = m_World->GetEntities();
|
||||||
|
|
||||||
@@ -73,13 +69,16 @@ void Systems::CollisionSystem::Intersects(EntityID aEntity, EntityID bEntity)
|
|||||||
if(bCollisionComponent == nullptr)
|
if(bCollisionComponent == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
auto transformSystem = m_World->GetSystem<Systems::TransformSystem>("TransformSystem");
|
||||||
|
|
||||||
|
>>>>>>> b81d60799e242ee073f5fa8bf1996c8c5878db06
|
||||||
auto aBounds = m_World->GetComponent<Components::Bounds>(aEntity, "Bounds");
|
auto aBounds = m_World->GetComponent<Components::Bounds>(aEntity, "Bounds");
|
||||||
|
|
||||||
auto bBounds = m_World->GetComponent<Components::Bounds>(bEntity, "Bounds");
|
auto bBounds = m_World->GetComponent<Components::Bounds>(bEntity, "Bounds");
|
||||||
|
|
||||||
glm::vec3 aPos = aTransform->Position + (aBounds->Origin * aTransform->Scale);
|
glm::vec3 aPos = transformSystem->AbsolutePosition(aEntity) + (aBounds->Origin * aTransform->Scale);
|
||||||
glm::vec3 bPos = bTransform->Position + (bBounds->Origin * bTransform->Scale);
|
glm::vec3 bPos = transformSystem->AbsolutePosition(bEntity) + (bBounds->Origin * bTransform->Scale);
|
||||||
|
|
||||||
glm::vec3 aMax = aPos + aBounds->VolumeVector * aTransform->Scale;
|
glm::vec3 aMax = aPos + aBounds->VolumeVector * aTransform->Scale;
|
||||||
glm::vec3 aMin = aPos - aBounds->VolumeVector * aTransform->Scale;
|
glm::vec3 aMin = aPos - aBounds->VolumeVector * aTransform->Scale;
|
||||||
@@ -89,8 +88,8 @@ void Systems::CollisionSystem::Intersects(EntityID aEntity, EntityID bEntity)
|
|||||||
if (aMin.x <= bMax.x && bMin.x <= aMax.x) {
|
if (aMin.x <= bMax.x && bMin.x <= aMax.x) {
|
||||||
if (aMin.y <= bMax.y && bMin.y <= aMax.y) {
|
if (aMin.y <= bMax.y && bMin.y <= aMax.y) {
|
||||||
if (aMin.z <= bMax.z && bMin.z <= aMax.z) {
|
if (aMin.z <= bMax.z && bMin.z <= aMax.z) {
|
||||||
aCollisionComponent->CollidingEntities.push_back(aEntity);
|
aCollisionComponent->CollidingEntities.push_back(bEntity);
|
||||||
bCollisionComponent->CollidingEntities.push_back(bEntity);
|
bCollisionComponent->CollidingEntities.push_back(aEntity);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ void Systems::LevelGenerationSystem::SpawnObstacle()
|
|||||||
|
|
||||||
void Systems::LevelGenerationSystem::Update( double dt )
|
void Systems::LevelGenerationSystem::Update( double dt )
|
||||||
{
|
{
|
||||||
|
|
||||||
elapsedtime += dt;
|
elapsedtime += dt;
|
||||||
spawnFrequency = 10/velocity;
|
spawnFrequency = 10/velocity;
|
||||||
|
|
||||||
@@ -103,9 +102,6 @@ void Systems::LevelGenerationSystem::Update( double dt )
|
|||||||
SpawnObstacle();
|
SpawnObstacle();
|
||||||
elapsedtime = 0;
|
elapsedtime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Systems::LevelGenerationSystem::UpdateEntity( double dt, EntityID entity, EntityID parent )
|
void Systems::LevelGenerationSystem::UpdateEntity( double dt, EntityID entity, EntityID parent )
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ Systems::PlayerSystem::PlayerSystem( World* world ) : System(world)
|
|||||||
m_poweruptimeleft = 0;
|
m_poweruptimeleft = 0;
|
||||||
m_basespeed = 125.f;
|
m_basespeed = 125.f;
|
||||||
m_maxspeed = 125.f;
|
m_maxspeed = 125.f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Systems::PlayerSystem::Update(double dt)
|
void Systems::PlayerSystem::Update(double dt)
|
||||||
@@ -195,7 +196,20 @@ void Systems::PlayerSystem::UpdateEntity(double dt, EntityID entity, EntityID pa
|
|||||||
{
|
{
|
||||||
if(m_World->GetProperty<std::string>(ent, "Name") == "Obstacle")
|
if(m_World->GetProperty<std::string>(ent, "Name") == "Obstacle")
|
||||||
{
|
{
|
||||||
|
|
||||||
|
auto deathSoundEntity = m_World->CreateEntity(ent);
|
||||||
|
|
||||||
|
auto deathTransform = m_World->AddComponent<Components::Transform>(deathSoundEntity, "Transform");
|
||||||
|
auto deathSoundEmitter = m_World->AddComponent<Components::SoundEmitter>(deathSoundEntity, "SoundEmitter");
|
||||||
|
deathSoundEmitter->Gain = 5.f;
|
||||||
|
deathSoundEmitter->ReferenceDistance = 1.5f;
|
||||||
|
|
||||||
|
auto deathSoundSystem = m_World->GetSystem<Systems::SoundSystem>("SoundSystem");
|
||||||
|
deathSoundSystem->PlaySound(deathSoundEmitter.get(), "Sounds/Explosion3.wav");
|
||||||
|
|
||||||
m_World->RemoveEntity(entity);
|
m_World->RemoveEntity(entity);
|
||||||
|
|
||||||
|
//TODO: Ljud som kommer från crashsite
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_World->GetProperty<std::string>(ent, "Name") == "Obstacle_SoundTrigger")
|
if (m_World->GetProperty<std::string>(ent, "Name") == "Obstacle_SoundTrigger")
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ namespace Systems
|
|||||||
private:
|
private:
|
||||||
float m_PlayerSpeed;
|
float m_PlayerSpeed;
|
||||||
glm::vec3 m_PlayerOriginalBounds;
|
glm::vec3 m_PlayerOriginalBounds;
|
||||||
|
|
||||||
glm::vec3 m_CameraOffset;
|
glm::vec3 m_CameraOffset;
|
||||||
glm::quat m_CameraOrientation;
|
glm::quat m_CameraOrientation;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user