Animation fixes

This commit is contained in:
viktorljung
2015-10-23 15:36:23 +02:00
parent a3354b856d
commit 48b9e8fbed
6 changed files with 211 additions and 192 deletions
+16 -1
View File
@@ -133,7 +133,8 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
auto cAnim = m_World->GetComponent<Components::Animation>(entity);
cAnim->Speed = 0.f;
//cAnim->Time = 0.f; //Maybe not the best but it works;
cAnim->Time = 0.f;
cAnim->Loop = false;
if (!ballComponent->Sticky) {
auto transform = m_World->GetComponent<Components::Transform>(entity);
@@ -157,6 +158,12 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
if (m_StickyCounter > 0) {
m_Sticky = true;
}
auto cAnim = m_World->GetComponent<Components::Animation>(entity);
cAnim->Speed = 2.f;
cAnim->Time = 0.f;
cAnim->Loop = false;
ballComponent->Sticky = false;
}
}
@@ -364,6 +371,14 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event)
ballTransform->Velocity *= -1;
Events::StickyAttachedToPad e;
EventBroker->Publish(e);
auto cModel = m_World->GetComponent<Components::Model>(ballEntity);
cModel->ModelFile = "Models/Sid/Sid_Jump.dae";
auto cAnim = m_World->GetComponent<Components::Animation>(ballEntity);
cAnim->Loop = false;
cAnim->Speed = 0.f;
cAnim->Time = 0.f;
return true;
}
}
+1 -1
View File
@@ -123,7 +123,7 @@ void dd::Systems::PadSystem::UpdateEntity(double dt, EntityID entity, EntityID p
if (ball->Waiting || ball->Sticky) {
if (m_ResetBall && ball->Waiting) {
ball->StickyPlacement = glm::vec3(0.f, 0.f, 0.f);
ball->StickyPlacement.y += 0.45f;
ball->StickyPlacement.y += 0.25f;
m_ResetBall = false;
}
auto ballTransform = m_World->GetComponent<Components::Transform>(entity);
+6 -2
View File
@@ -108,18 +108,20 @@ bool dd::Systems::ProjectileSystem::OnInkBlaster(const dd::Events::InkBlaster &e
bool dd::Systems::ProjectileSystem::OnHitPad(const dd::Events::HitPad &event)
{
if (m_InkBlaster) {
if (m_InkBlaster && m_AttachedSquid == 0) {
auto ball = m_World->GetComponent<Components::Ball>(event.Ball);
ball->Loaded = true;
m_SquidLoaded = true;
m_AttachedSquid = event.Ball;
auto model = m_World->GetComponent<Components::Model>(m_AttachedSquid);
model->ModelFile = "Models/Sid/Sid_Shoot.dae";
auto anim = m_World->GetComponent<Components::Animation>(m_AttachedSquid);
anim->Loop = false;
anim->Speed = 0.f;
anim->Time = 0.f;
}
return true;
}
@@ -151,7 +153,7 @@ bool dd::Systems::ProjectileSystem::OnActionButton(const dd::Events::ActionButto
auto anim = m_World->GetComponent<Components::Animation>(m_AttachedSquid);
anim->Loop = false;
anim->Speed = 1.f;
anim->Speed = 2.f;
anim->Time = 0.f;
if (m_Shots <= 0) {
@@ -166,6 +168,7 @@ bool dd::Systems::ProjectileSystem::OnActionButton(const dd::Events::ActionButto
{
Events::InkBlasterOver e;
e.Ball = m_AttachedSquid;
EventBroker->Publish(e);
auto model = m_World->GetComponent<Components::Model>(m_AttachedSquid);
@@ -174,6 +177,7 @@ bool dd::Systems::ProjectileSystem::OnActionButton(const dd::Events::ActionButto
auto anim = m_World->GetComponent<Components::Animation>(m_AttachedSquid);
anim->Loop = true;
anim->Speed = 1.f;
m_AttachedSquid = 0;
}
{
Events::ActionButton e;