stuff
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
#include "CharacterManager.h"
|
||||
#include "Animator.h"
|
||||
#include "Character.h"
|
||||
#include "Physics.h"
|
||||
#include "Rig.h"
|
||||
#include "tFunctions.h"
|
||||
|
||||
CharacterManager::CharacterManager() = default;
|
||||
CharacterManager::~CharacterManager() = default;
|
||||
@@ -89,33 +87,3 @@ void CharacterManager::Step(float dt) {
|
||||
for (Character* character : characterOrder)
|
||||
character->Step(dt);
|
||||
}
|
||||
|
||||
void CharacterManager::ResolveCombat(Physics& physics) {
|
||||
for (Character* attacker : characterOrder) {
|
||||
Hitbox& hitbox = attacker->punchHitbox;
|
||||
if (!hitbox.active || hitbox.damage <= 0)
|
||||
continue;
|
||||
|
||||
for (Character* target : characterOrder) {
|
||||
if (target == attacker || !hitbox.CanHit(target))
|
||||
continue;
|
||||
|
||||
if (!BoundingBoxInBoundingBox(hitbox.transform.GetAABB(), target->body->t.GetAABB()))
|
||||
continue;
|
||||
|
||||
hitbox.RegisterHit(target);
|
||||
target->body->Health = std::max(0, target->body->Health - hitbox.damage);
|
||||
|
||||
glm::vec3 knockback = target->body->t.GetTranslation() -
|
||||
attacker->body->t.GetTranslation();
|
||||
knockback.y = 0.0f;
|
||||
if (glm::length(knockback) > 0.0001f)
|
||||
knockback = glm::normalize(knockback) * hitbox.knockback;
|
||||
knockback.y = 1.5f;
|
||||
if (p* targetBody = physics.PPointerOfObject(target->body)) {
|
||||
targetBody->linearvelocity += knockback;
|
||||
targetBody->WakeUp();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user