now using a define INDICATOR_TEST to activate the DamageIndicatorSystem test.

This commit is contained in:
verysecrethero
2016-02-24 13:58:05 +01:00
parent e2831c5593
commit af68236e71
2 changed files with 8 additions and 4 deletions
+4 -2
View File
@@ -14,6 +14,7 @@
#include <glm/gtx/vector_angle.hpp> #include <glm/gtx/vector_angle.hpp>
#include "Rendering/Util/CommonFunctions.h" #include "Rendering/Util/CommonFunctions.h"
//#define INDICATOR_TEST
class DamageIndicatorSystem : public ImpureSystem class DamageIndicatorSystem : public ImpureSystem
{ {
@@ -40,8 +41,9 @@ private:
float CalculateAngle(EntityWrapper player, glm::vec3 enemyPos); float CalculateAngle(EntityWrapper player, glm::vec3 enemyPos);
//for tests //for tests
int m_TestVar = 0; #ifdef INDICATOR_TEST
bool m_Testing = false;
glm::vec3 DamageIndicatorTest(EntityWrapper player); glm::vec3 DamageIndicatorTest(EntityWrapper player);
int m_TestVar = 0;
#endif
}; };
#endif #endif
+4 -2
View File
@@ -42,9 +42,9 @@ bool DamageIndicatorSystem::OnPlayerDamage(Events::PlayerDamage& e)
glm::vec3 inflictorPos = e.Inflictor["Transform"]["Position"]; glm::vec3 inflictorPos = e.Inflictor["Transform"]["Position"];
//if testing //if testing
if (m_Testing) { #ifdef INDICATOR_TEST
inflictorPos = DamageIndicatorTest(e.Victim); inflictorPos = DamageIndicatorTest(e.Victim);
} #endif
float angleBetweenVectors = CalculateAngle(e.Victim, inflictorPos); float angleBetweenVectors = CalculateAngle(e.Victim, inflictorPos);
@@ -100,6 +100,7 @@ float DamageIndicatorSystem::CalculateAngle(EntityWrapper player, glm::vec3 enem
return angleBetweenVectors; return angleBetweenVectors;
} }
#ifdef INDICATOR_TEST
glm::vec3 DamageIndicatorSystem::DamageIndicatorTest(EntityWrapper player) { glm::vec3 DamageIndicatorSystem::DamageIndicatorTest(EntityWrapper player) {
auto currentPos = (glm::vec3)player["Transform"]["Position"]; auto currentPos = (glm::vec3)player["Transform"]["Position"];
@@ -145,3 +146,4 @@ glm::vec3 DamageIndicatorSystem::DamageIndicatorTest(EntityWrapper player) {
deathEffectEW["Transform"]["Orientation"] = (glm::vec3)player["Transform"]["Orientation"]; deathEffectEW["Transform"]["Orientation"] = (glm::vec3)player["Transform"]["Orientation"];
return inflictorPos; return inflictorPos;
} }
#endif