CapturePointSystem updated, all tests are green

This commit is contained in:
verysecrethero
2016-01-19 17:19:58 +01:00
parent f197993beb
commit b45de542da
9 changed files with 121 additions and 58 deletions
+9 -12
View File
@@ -38,24 +38,21 @@ GameHealthSystemTest::GameHealthSystemTest()
// Create the core event broker
m_EventBroker = new EventBroker();
// Create a world
// Create a world
m_World = new World();
std::string mapToLoad = m_Config->Get<std::string>("Debug.LoadMap", "");
if (!mapToLoad.empty()) {
auto file = ResourceManager::Load<EntityFile>(mapToLoad);
EntityFilePreprocessor fpp(file);
fpp.RegisterComponents(m_World);
EntityFileParser fp(file);
fp.MergeEntities(m_World);
}
auto file = ResourceManager::Load<EntityFile>("Schema/Entities/TeamTest.xml");
EntityFilePreprocessor fpp(file);
fpp.RegisterComponents(m_World);
EntityFileParser fp(file);
fp.MergeEntities(m_World);
// Create system pipeline
m_SystemPipeline = new SystemPipeline(m_EventBroker);
m_SystemPipeline->AddSystem<HealthSystem>(0);
//The Test
//create entity which has transorm,player,model,health in it. i.e. is a player
//create entity which has transform,player,model,health in it. i.e. is a player
EntityID playerID = m_World->CreateEntity();
ComponentWrapper transform = m_World->AttachComponent(playerID, "Transform");
ComponentWrapper model = m_World->AttachComponent(playerID, "Model");
@@ -78,7 +75,7 @@ GameHealthSystemTest::GameHealthSystemTest()
//heal some other player with 40
Events::PlayerHealthPickup e2;
e2.HealthAmount = 40.0f;
e2.PlayerHealedID = healthsID+1;
e2.PlayerHealedID = healthsID + 1;
m_EventBroker->Publish(e2);
EntityID playerID2 = m_World->CreateEntity();
@@ -113,6 +110,6 @@ void GameHealthSystemTest::Tick()
//if health reaches 90 then we know the test has succeeded (start with 100hp, remove 50hp, add 40hp)
double currentHealth = (double)m_World->GetComponent(healthsID, "Health")["Health"];
if (currentHealth==90)
if (currentHealth == 90)
TestSucceeded = true;
}