feat: player now uses damage events
This commit is contained in:
parent
f201fe50f5
commit
5fac1f1629
|
@ -1,4 +1,5 @@
|
||||||
#include "PlayerStates.h"
|
#include "PlayerStates.h"
|
||||||
|
#include "DamageEvent.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "Layers.h"
|
#include "Layers.h"
|
||||||
#include "physics_world.h"
|
#include "physics_world.h"
|
||||||
|
@ -57,7 +58,11 @@ void PlayerAttackTrigger(Player* self) {
|
||||||
MakeVector(0.1f, 0.06f), PHYSICS_LAYER_COMBAT, self->rigidbody);
|
MakeVector(0.1f, 0.06f), PHYSICS_LAYER_COMBAT, self->rigidbody);
|
||||||
if(found != NULL) {
|
if(found != NULL) {
|
||||||
PhysicsEntity entity = collider_get_owner(found);
|
PhysicsEntity entity = collider_get_owner(found);
|
||||||
entity.message_receiver->handle_message(entity.data, 1, 1u);
|
DamageEventData data = {
|
||||||
|
.damageAmount = 1,
|
||||||
|
.origin = self->transform.position
|
||||||
|
};
|
||||||
|
entity.message_receiver->handle_message(entity.data, 1, (uintptr_t)&data);
|
||||||
}
|
}
|
||||||
++self->animationTriggers;
|
++self->animationTriggers;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue