Removed unnecessary string in EPlayerDamage (TypeOfDamage). Renamed a variable in WeaponSystem

This commit is contained in:
verysecrethero
2016-01-21 16:30:07 +01:00
parent 7deb32431e
commit 973ccd34c9
4 changed files with 4 additions and 9 deletions
+4 -5
View File
@@ -16,20 +16,19 @@ void WeaponSystem::Update(World* world, double dt)
//TODO: check if player has enough ammo and if weapon has a cooldown or not
//pick the object
PickData somePickData = m_Renderer->Pick(std::get<1>(m_EShootVector[i - 1]));
if (somePickData.Entity == EntityID_Invalid) {
PickData pickDataFromShot = m_Renderer->Pick(std::get<1>(m_EShootVector[i - 1]));
if (pickDataFromShot.Entity == EntityID_Invalid) {
m_EShootVector.erase(m_EShootVector.begin() + i - 1);
continue;
}
//if its a player, do PlayerDamage event
const bool hasPlayerComponent = world->HasComponent(somePickData.Entity, "Player");
const bool hasPlayerComponent = world->HasComponent(pickDataFromShot.Entity, "Player");
if (hasPlayerComponent) {
Events::PlayerDamage ePlayerDamage;
//TODO: damage based on weapontype/class?
//TODO: multiple shots at the same time? (shotgunner)
ePlayerDamage.DamageAmount = 25;
ePlayerDamage.PlayerDamagedID = somePickData.Entity;
ePlayerDamage.TypeOfDamage = "Some Weapon";
ePlayerDamage.PlayerDamagedID = pickDataFromShot.Entity;
m_EventBroker->Publish(ePlayerDamage);
}
m_EShootVector.erase(m_EShootVector.begin() + i - 1);