Fixed Sticky after Ink bug, fixed directions on Squid after sticky, laser direction is in background. Brick Components implemented, though they do nothing.
This commit is contained in:
@@ -195,11 +195,14 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
||||
}
|
||||
|
||||
if (ballComponent != nullptr) {
|
||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||
glm::vec2 dir = glm::normalize(glm::vec2(transform->Velocity.x, transform->Velocity.y));
|
||||
glm::vec2 up = glm::vec2(0.f, 1.f);
|
||||
float angle = glm::acos(glm::dot<float>(dir, up)) * glm::sign(dir.x);
|
||||
transform->Orientation = glm::rotate(glm::quat(), angle, glm::vec3(0.f, 0.f, -1.f));
|
||||
if (!ballComponent->Sticky)
|
||||
{
|
||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||
glm::vec2 dir = glm::normalize(glm::vec2(transform->Velocity.x, transform->Velocity.y));
|
||||
glm::vec2 up = glm::vec2(0.f, 1.f);
|
||||
float angle = glm::acos(glm::dot<float>(dir, up)) * glm::sign(dir.x);
|
||||
transform->Orientation = glm::rotate(glm::quat(), angle, glm::vec3(0.f, 0.f, -1.f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,7 +461,6 @@ bool dd::Systems::BallSystem::OnInkBlasterOver(const dd::Events::InkBlasterOver
|
||||
m_InkBlaster = false;
|
||||
m_InkAttached = false;
|
||||
m_BlockedWaiting = false;
|
||||
m_Sticky = true;
|
||||
ballComponent->SavedSpeed = glm::normalize(glm::vec3(0.f, 1.f, 0.f)) * ballComponent->Speed;
|
||||
m_Waiting = false;
|
||||
transform->Velocity = glm::normalize(glm::vec3(0.f, 1, 0.f)) * ballComponent->Speed;
|
||||
|
||||
@@ -200,21 +200,28 @@ void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBe
|
||||
auto cBrick = m_World->GetComponent<Components::Brick>(brick);
|
||||
auto model = m_World->GetComponent<Components::Model>(brick);
|
||||
if (typeInt == StandardBrick) {
|
||||
cBrick->Type = StandardBrick;
|
||||
auto type = m_World->AddComponent<Components::StandardBrick>(brick);
|
||||
model->Color = colorVec;
|
||||
} else if (typeInt == MultiBallBrick) {
|
||||
cBrick->Type = MultiBallBrick;
|
||||
auto type = m_World->AddComponent<Components::MultiBallBrick>(brick);
|
||||
model->ModelFile = "Models/Brick/IceBrick.obj";
|
||||
} else if (typeInt == LifebuoyBrick) {
|
||||
cBrick->Type = LifebuoyBrick;
|
||||
auto type = m_World->AddComponent<Components::LifebuoyBrick>(brick);
|
||||
model->ModelFile = "Models/Brick/LifeBuoyBrick.obj";
|
||||
} else if (typeInt == StickyBrick) {
|
||||
cBrick->Type = StickyBrick;
|
||||
auto type = m_World->AddComponent<Components::StickyBrick>(brick);
|
||||
model->ModelFile = "Models/Brick/StickyBrick.obj";
|
||||
} else if (typeInt == InkBlasterBrick) {
|
||||
cBrick->Type = InkBlasterBrick;
|
||||
auto type = m_World->AddComponent<Components::InkBlasterBrick>(brick);
|
||||
model->Color = glm::vec4(0.1f, 0.1f, 0.1f, 1.0f);
|
||||
} else if (typeInt == KrakenAttackBrick) {
|
||||
cBrick->Type = KrakenAttackBrick;
|
||||
auto type = m_World->AddComponent<Components::KrakenAttackBrick>(brick);
|
||||
model->Color = glm::vec4(0.f, 0.5f, 1.0f, .0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ void dd::Systems::PadSystem::Initialize()
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &PadSystem::OnStageCleared);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &PadSystem::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EKrakenAttack, &PadSystem::OnKrakenAttack);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EStickyPad, &PadSystem::OnStickyPad);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &PadSystem::OnActionButton);
|
||||
//EVENT_SUBSCRIBE_MEMBER(m_EBindKey, &PadSystem::OnBindKey);
|
||||
|
||||
@@ -53,6 +54,21 @@ void dd::Systems::PadSystem::Initialize()
|
||||
|
||||
SetEdge(3.2 - (ctransform->Scale.x / 2));
|
||||
}
|
||||
|
||||
//Stick
|
||||
{
|
||||
auto ent = m_World->CreateEntity();
|
||||
m_World->SetProperty(ent, "Name", "Stick");
|
||||
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(ent);
|
||||
transform->Position = glm::vec3(30.f, 0.f, -10.f);
|
||||
transform->Scale = glm::vec3(0.1f, 20.f, 0.1f);
|
||||
std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(ent);
|
||||
sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
|
||||
std::shared_ptr<Components::StickyAim> sticky = m_World->AddComponent<Components::StickyAim>(ent);
|
||||
m_World->CommitEntity(ent);
|
||||
|
||||
m_StickTransform = transform;
|
||||
}
|
||||
}
|
||||
|
||||
void dd::Systems::PadSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||
@@ -63,9 +79,21 @@ void dd::Systems::PadSystem::UpdateEntity(double dt, EntityID entity, EntityID p
|
||||
auto ball = m_World->GetComponent<Components::Ball>(entity);
|
||||
if (ball != nullptr) {
|
||||
if (ball->Sticky) {
|
||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||
transform->Position = Transform()->Position;
|
||||
transform->Position += ball->StickyPlacement;
|
||||
auto ballTransform = m_World->GetComponent<Components::Transform>(entity);
|
||||
ballTransform->Position = Transform()->Position;
|
||||
ballTransform->Position += ball->StickyPlacement;
|
||||
glm::vec2 dir = glm::normalize(glm::vec2(ball->SavedSpeed.x, ball->SavedSpeed.y));
|
||||
glm::vec2 up = glm::vec2(0.f, 1.f);
|
||||
float angle = glm::acos(glm::dot<float>(dir, up)) * glm::sign(dir.x);
|
||||
ballTransform->Orientation = glm::rotate(glm::quat(), angle, glm::vec3(0.f, 0.f, -1.f));
|
||||
/*if (m_StickyAim->Aiming) {
|
||||
m_StickTransform->Orientation = glm::rotate(glm::quat(), angle, glm::vec3(0.f, 0.f, 1.f));
|
||||
m_StickTransform->Position = ballTransform->Position;
|
||||
}*/
|
||||
} else {
|
||||
/*if (!m_StickyAim->Aiming) {
|
||||
m_StickTransform->Position = glm::vec3(30.f, 0.f, 0.f);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,7 +209,15 @@ bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) {
|
||||
} else if (val == GLFW_KEY_S) {
|
||||
Events::StageCleared e;
|
||||
EventBroker->Publish(e);
|
||||
} else if (val == GLFW_KEY_K) {
|
||||
} else if (val == GLFW_KEY_Y) {
|
||||
Events::StickyPad e;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
else if (val == GLFW_KEY_I) {
|
||||
Events::InkBlaster e;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
else if (val == GLFW_KEY_K) {
|
||||
Events::KrakenAttack e;
|
||||
e.ChargeUpdate = 0;
|
||||
e.KrakenStrength = 0.1;
|
||||
@@ -333,6 +369,11 @@ bool dd::Systems::PadSystem::OnKrakenAttack(const dd::Events::KrakenAttack &even
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::PadSystem::OnStickyPad(const dd::Events::StickyPad &event)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dd::Systems::PadSystem::OnActionButton(const dd::Events::ActionButton &event)
|
||||
{
|
||||
if (m_KrakenAttack) {
|
||||
|
||||
Reference in New Issue
Block a user