Merge branch 'master' of github.com:teamfisk/AgileBreakOut
This commit is contained in:
@@ -90,8 +90,8 @@ private:
|
|||||||
float m_Edge = 2.8f;
|
float m_Edge = 2.8f;
|
||||||
float m_PadOriginalHeight = -4.8;
|
float m_PadOriginalHeight = -4.8;
|
||||||
float m_PadHeight = m_PadOriginalHeight;
|
float m_PadHeight = m_PadOriginalHeight;
|
||||||
EntityID m_KrakenArm = NULL;
|
EntityID m_KrakenArm = 0;
|
||||||
EntityID m_KrakenArmHitbox = NULL;
|
EntityID m_KrakenArmHitbox = 0;
|
||||||
float m_PadRiseSpeed = 0.2;
|
float m_PadRiseSpeed = 0.2;
|
||||||
Components::Transform* m_PadTransform = nullptr;
|
Components::Transform* m_PadTransform = nullptr;
|
||||||
Components::Pad* m_PadComponent = nullptr;
|
Components::Pad* m_PadComponent = nullptr;
|
||||||
|
|||||||
+28
-26
@@ -59,6 +59,10 @@ void dd::Systems::PadSystem::Initialize()
|
|||||||
m_World->CommitEntity(ent);
|
m_World->CommitEntity(ent);
|
||||||
|
|
||||||
m_Edge = 3.2 - (ctransform->Scale.x / 2);
|
m_Edge = 3.2 - (ctransform->Scale.x / 2);
|
||||||
|
|
||||||
|
m_PadEntity = ent;
|
||||||
|
m_PadTransform = ctransform.get();
|
||||||
|
m_PadComponent = pad.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Stick
|
//Stick
|
||||||
@@ -89,6 +93,19 @@ void dd::Systems::PadSystem::Initialize()
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Kraken arm
|
||||||
|
{
|
||||||
|
m_KrakenArm = m_World->CreateEntity(m_PadEntity);
|
||||||
|
auto transform = m_World->AddComponent<Components::Transform>(m_KrakenArm);
|
||||||
|
transform->Position = glm::vec3(1.f, -3.0f, 0.f);
|
||||||
|
auto model = m_World->AddComponent<Components::Model>(m_KrakenArm);
|
||||||
|
model->ModelFile = "Models/Kraken/Arm.dae";
|
||||||
|
auto animation = m_World->AddComponent<Components::Animation>(m_KrakenArm);
|
||||||
|
animation->Speed = 0.0f;
|
||||||
|
animation->Loop = false;
|
||||||
|
m_World->CommitEntity(m_KrakenArm);
|
||||||
|
}
|
||||||
|
|
||||||
m_ResetBall = true;
|
m_ResetBall = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,17 +150,6 @@ void dd::Systems::PadSystem::Update(double dt)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_PadEntity == 0) {
|
|
||||||
for (auto it = m_World->GetEntities()->begin(); it != m_World->GetEntities()->end(); it++) {
|
|
||||||
if (m_World->GetProperty<std::string>(it->first, "Name") == "Pad") {
|
|
||||||
m_PadEntity = it->first;
|
|
||||||
m_PadTransform = m_World->GetComponent<Components::Transform>(m_PadEntity);
|
|
||||||
m_PadComponent = m_World->GetComponent<Components::Pad>(m_PadEntity);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_KrakenAttack) {
|
if (m_KrakenAttack) {
|
||||||
m_KrakenCharge -= m_KrakenStrength * dt;
|
m_KrakenCharge -= m_KrakenStrength * dt;
|
||||||
if (m_KrakenCharge < 0) {
|
if (m_KrakenCharge < 0) {
|
||||||
@@ -476,18 +482,10 @@ bool dd::Systems::PadSystem::OnKrakenAttack(const dd::Events::KrakenAttack &even
|
|||||||
|
|
||||||
transform->Velocity = glm::vec3(0, 0, 0);
|
transform->Velocity = glm::vec3(0, 0, 0);
|
||||||
acceleration = glm::vec3(0, 0, 0);
|
acceleration = glm::vec3(0, 0, 0);
|
||||||
LOG_INFO("Kraken arm duuude");
|
if (m_KrakenArmHitbox == 0) {
|
||||||
if (!m_KrakenArm){
|
auto animation = m_World->GetComponent<Components::Animation>(m_KrakenArm);
|
||||||
LOG_INFO("InKrakenArmDuuude");
|
animation->Time = 0.0;
|
||||||
m_KrakenArm = m_World->CreateEntity(m_PadEntity);
|
animation->Speed = 1.0;
|
||||||
auto transform = m_World->AddComponent<Components::Transform>(m_KrakenArm);
|
|
||||||
transform->Position = glm::vec3(1.f, -3.0f, 0.f);
|
|
||||||
auto model = m_World->AddComponent<Components::Model>(m_KrakenArm);
|
|
||||||
model->ModelFile = "Models/Kraken/Arm.dae";
|
|
||||||
auto animation = m_World->AddComponent<Components::Animation>(m_KrakenArm);
|
|
||||||
animation->Speed = 1.0f;
|
|
||||||
animation->Loop = false;
|
|
||||||
m_World->CommitEntity(m_KrakenArm);
|
|
||||||
|
|
||||||
m_KrakenArmHitbox = m_World->CreateEntity();
|
m_KrakenArmHitbox = m_World->CreateEntity();
|
||||||
auto hb_transform = m_World->AddComponent<Components::Transform>(m_KrakenArmHitbox);
|
auto hb_transform = m_World->AddComponent<Components::Transform>(m_KrakenArmHitbox);
|
||||||
@@ -525,10 +523,14 @@ bool dd::Systems::PadSystem::OnKrakenAttackEnd(const dd::Events::KrakenAttackEnd
|
|||||||
m_KrakenStrength = 0;
|
m_KrakenStrength = 0;
|
||||||
m_PlayerStrength = 0;
|
m_PlayerStrength = 0;
|
||||||
|
|
||||||
m_World->RemoveEntity(m_KrakenArm);
|
//m_World->RemoveEntity(m_KrakenArm);
|
||||||
|
|
||||||
|
auto animation = m_World->GetComponent<Components::Animation>(m_KrakenArm);
|
||||||
|
animation->Time = 0.0;
|
||||||
|
animation->Speed = -1.5;
|
||||||
m_World->RemoveEntity(m_KrakenArmHitbox);
|
m_World->RemoveEntity(m_KrakenArmHitbox);
|
||||||
m_KrakenArm = NULL;
|
//m_KrakenArm = NULL;
|
||||||
m_KrakenArmHitbox = NULL;
|
m_KrakenArmHitbox = 0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,19 +35,18 @@ void dd::Systems::AnimationSystem::Update(double dt)
|
|||||||
|
|
||||||
if (animationComponent->Speed != 0.0) {
|
if (animationComponent->Speed != 0.0) {
|
||||||
double nextTime = animationComponent->Time + animationComponent->Speed * dt;
|
double nextTime = animationComponent->Time + animationComponent->Speed * dt;
|
||||||
if (glm::abs(nextTime) > animation->Duration) {
|
if (!animationComponent->Loop && glm::abs(nextTime) > animation->Duration) {
|
||||||
if (!animationComponent->Loop) {
|
|
||||||
animationComponent->Time = glm::sign(nextTime) * animation->Duration;
|
animationComponent->Time = glm::sign(nextTime) * animation->Duration;
|
||||||
animationComponent->Speed = 0.0;
|
animationComponent->Speed = 0.0;
|
||||||
LOG_DEBUG("Animation \"%s\" on Entity %i finished.", animationComponent->Name.c_str(), ent);
|
LOG_DEBUG("Animation \"%s\" on Entity %i finished.", animationComponent->Name.c_str(), ent);
|
||||||
Events::AnimationComplete e;
|
Events::AnimationComplete e;
|
||||||
e.Entity = ent;
|
e.Entity = ent;
|
||||||
e.Animation = animationComponent->Name;
|
e.Animation = animationComponent->Name;
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
animationComponent->Time = nextTime;
|
animationComponent->Time = nextTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dd::Systems::AnimationSystem::OnPause(const Events::Pause& e)
|
bool dd::Systems::AnimationSystem::OnPause(const Events::Pause& e)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ std::vector<glm::mat4> dd::Skeleton::GetFrameBones(const Animation& animation, d
|
|||||||
int currentKeyframeIndex = GetKeyframe(animation, time);
|
int currentKeyframeIndex = GetKeyframe(animation, time);
|
||||||
|
|
||||||
const Animation::Keyframe& currentFrame = animation.Keyframes[currentKeyframeIndex];
|
const Animation::Keyframe& currentFrame = animation.Keyframes[currentKeyframeIndex];
|
||||||
const Animation::Keyframe& nextFrame = animation.Keyframes[currentKeyframeIndex + 1];
|
const Animation::Keyframe& nextFrame = animation.Keyframes[(currentKeyframeIndex + 1) % animation.Keyframes.size()];
|
||||||
float alpha = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
float alpha = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
||||||
|
|
||||||
//auto animationFrame = Animations[""].Keyframes[frame];
|
//auto animationFrame = Animations[""].Keyframes[frame];
|
||||||
@@ -149,7 +149,7 @@ int dd::Skeleton::GetKeyframe(const Animation& animation, double time)
|
|||||||
{
|
{
|
||||||
if (time < 0)
|
if (time < 0)
|
||||||
time = 0;
|
time = 0;
|
||||||
if (time > animation.Duration)
|
if (time >= animation.Duration)
|
||||||
return animation.Keyframes.size() - 1;
|
return animation.Keyframes.size() - 1;
|
||||||
|
|
||||||
for (int keyframe = 0; keyframe < animation.Keyframes.size(); ++keyframe) {
|
for (int keyframe = 0; keyframe < animation.Keyframes.size(); ++keyframe) {
|
||||||
|
|||||||
Reference in New Issue
Block a user