Aimer for Sticky Works, though stuff.

This commit is contained in:
PlatinumSkink
2015-10-12 18:18:37 +02:00
parent 02d724fedd
commit 32bbf282c9
10 changed files with 195 additions and 111 deletions
+14 -8
View File
@@ -30,6 +30,7 @@ void dd::Systems::PadSystem::Initialize()
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_EStickyAttachedToPad, &PadSystem::OnStickyAttachedToPad);
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &PadSystem::OnActionButton);
//EVENT_SUBSCRIBE_MEMBER(m_EBindKey, &PadSystem::OnBindKey);
@@ -68,6 +69,7 @@ void dd::Systems::PadSystem::Initialize()
m_World->CommitEntity(ent);
m_StickTransform = transform;
m_StickyAim = sticky;
}
}
@@ -86,14 +88,11 @@ void dd::Systems::PadSystem::UpdateEntity(double dt, EntityID entity, EntityID p
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);
}*/
m_StickTransform->Orientation = glm::rotate(glm::quat(), angle, glm::vec3(0.f, 0.f, 1.f));
m_StickTransform->Position = ballTransform->Position;
}
if (!m_StickyAim->Aiming) {
m_StickTransform->Position = glm::vec3(30.f, 0.f, 0.f);
}
}
}
@@ -374,6 +373,12 @@ bool dd::Systems::PadSystem::OnStickyPad(const dd::Events::StickyPad &event)
return true;
}
bool dd::Systems::PadSystem::OnStickyAttachedToPad(const dd::Events::StickyAttachedToPad &event)
{
m_StickyAim->Aiming = true;
return true;
}
bool dd::Systems::PadSystem::OnActionButton(const dd::Events::ActionButton &event)
{
if (m_KrakenAttack) {
@@ -385,6 +390,7 @@ bool dd::Systems::PadSystem::OnActionButton(const dd::Events::ActionButton &even
e.PlayerStrength = 0;
EventBroker->Publish(e);
}
m_StickyAim->Aiming = false;
return true;
}