Created
February 17, 2014 22:20
-
-
Save kcbanner/9060377 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void AttackComponent::onEntityCollisionEvent(IEventPtr pEvent) { | |
std::shared_ptr<EntityCollisionEvent> pCastEvent = std::static_pointer_cast<EntityCollisionEvent>(pEvent); | |
// Don't care if we collide with our selves | |
const RigidBody* aRigidBody = pCastEvent->getRigidBodyA(); | |
if (aRigidBody->name == PROJECTILE_RIGID_BODY_NAME && aRigidBody->parent == mParent) { | |
// Play the hit animation | |
Projectile* projectile = (Projectile*)((char*)aRigidBody - offsetof(Projectile, rigidBody)); | |
projectileHit(projectile); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment