Added Assault,Defender,Sniper Components,Entities. Added ShieldAbility,Sprintability-Component (not implemented). Changed BoostSystem to use a childed Boost to the player. All friendly fire is 0 damage.

This commit is contained in:
verysecrethero
2016-02-18 10:40:09 +01:00
parent c3ed429377
commit 7f489b3569
19 changed files with 125 additions and 32 deletions
+13 -10
View File
@@ -25,35 +25,38 @@ bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e)
return false;
}
//friendly fire
auto className = determineClass(e.Inflictor);
auto className = DetermineClass(e.Inflictor);
if (className == "") {
return false;
}
//"Schema/Entities/BoostAssault.xml"
//"Schema/Entities/Boost-.xml"
std::string classXML = "Schema/Entities/" + className + ".xml";
//class
//check if player already has the component
auto playerBoostAssaultEntity = e.Victim.FirstChildByName(className);
if (playerBoostAssaultEntity.Valid()) {
m_World->DeleteEntity(playerBoostAssaultEntity.ID);
}
//load & set the BoostAssault Component
auto entityFile = ResourceManager::Load<EntityFile>(classXML);
EntityFileParser parser(entityFile);
EntityID boostAssaultEntity = parser.MergeEntities(m_World);
m_World->SetName(boostAssaultEntity, className);
m_World->SetParent(boostAssaultEntity, e.Victim.ID);
return true;
}
std::string BoostSystem::determineClass(EntityWrapper player)
std::string BoostSystem::DetermineClass(EntityWrapper inflictorPlayer)
{
if (m_World->HasComponent(player.ID, "DashAbility")) {
//determine the class based on what component the inflictor-player has
if (m_World->HasComponent(inflictorPlayer.ID, "DashAbility")) {
return "BoostAssault";
}
if (m_World->HasComponent(player.ID, "DefenderShield")) {
if (m_World->HasComponent(inflictorPlayer.ID, "ShieldAbility")) {
return "BoostDefender";
}
if (m_World->HasComponent(player.ID, "SniperSprint")) {
if (m_World->HasComponent(inflictorPlayer.ID, "SprintAbility")) {
return "BoostSniper";
}
return "";