CapturePointSystem updated, all tests are green
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user