Added BoostSystem, Added BoostAssault entity XML
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
#ifndef BoostSystem_h__
|
||||||
|
#define BoostSystem_h__
|
||||||
|
|
||||||
|
#include "Core/System.h"
|
||||||
|
#include "Core/Transform.h"
|
||||||
|
#include "Core/ResourceManager.h"
|
||||||
|
#include "Core/EntityFileParser.h"
|
||||||
|
#include "Core/EPlayerDamage.h"
|
||||||
|
#include "Common.h"
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
|
#include "Rendering/Util/CommonFunctions.h"
|
||||||
|
|
||||||
|
class BoostSystem : public System
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BoostSystem(SystemParams params);
|
||||||
|
|
||||||
|
private:
|
||||||
|
EventRelay<BoostSystem, Events::PlayerDamage> m_EPlayerDamage;
|
||||||
|
bool OnPlayerDamage(Events::PlayerDamage& e);
|
||||||
|
|
||||||
|
std::string determineClass(EntityWrapper player);
|
||||||
|
};
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:BoostAssault/>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>55</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,7 @@
|
|||||||
#include "Network/MultiplayerSnapshotFilter.h"
|
#include "Network/MultiplayerSnapshotFilter.h"
|
||||||
#include "Game/Systems/AmmunitionHUDSystem.h"
|
#include "Game/Systems/AmmunitionHUDSystem.h"
|
||||||
#include "Game/Systems/KillFeedSystem.h"
|
#include "Game/Systems/KillFeedSystem.h"
|
||||||
|
#include "Game/Systems/BoostSystem.h"
|
||||||
|
|
||||||
|
|
||||||
Game::Game(int argc, char* argv[])
|
Game::Game(int argc, char* argv[])
|
||||||
@@ -132,6 +133,7 @@ Game::Game(int argc, char* argv[])
|
|||||||
m_SystemPipeline->AddSystem<DamageIndicatorSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<DamageIndicatorSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<AmmunitionHUDSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<AmmunitionHUDSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<KillFeedSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<KillFeedSystem>(updateOrderLevel);
|
||||||
|
m_SystemPipeline->AddSystem<BoostSystem>(updateOrderLevel);
|
||||||
// Populate Octree with collidables
|
// Populate Octree with collidables
|
||||||
++updateOrderLevel;
|
++updateOrderLevel;
|
||||||
m_SystemPipeline->AddSystem<FillOctreeSystem>(updateOrderLevel, m_OctreeCollision, "Collidable");
|
m_SystemPipeline->AddSystem<FillOctreeSystem>(updateOrderLevel, m_OctreeCollision, "Collidable");
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
#include "Systems/BoostSystem.h"
|
||||||
|
|
||||||
|
BoostSystem::BoostSystem(SystemParams params)
|
||||||
|
: System(params)
|
||||||
|
{
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &BoostSystem::OnPlayerDamage);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e)
|
||||||
|
{
|
||||||
|
if (e.Victim.ID == e.Inflictor.ID) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!e.Victim.Valid() && e.Victim != LocalPlayer && !e.Victim.IsChildOf(LocalPlayer)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!e.Inflictor.Valid() || !e.Victim.Valid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto teamInflictor = m_World->GetComponent(e.Inflictor.ID, "Team");
|
||||||
|
auto teamVictim = m_World->GetComponent(e.Victim.ID, "Team");
|
||||||
|
if ((int)teamInflictor["Team"] != (int)teamVictim["Team"]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//friendly fire
|
||||||
|
|
||||||
|
auto className = determineClass(e.Inflictor);
|
||||||
|
if (className == "") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//"Schema/Entities/BoostAssault.xml"
|
||||||
|
std::string classXML = "Schema/Entities/" + className + ".xml";
|
||||||
|
|
||||||
|
//class
|
||||||
|
|
||||||
|
//load & set the BoostAssault Component
|
||||||
|
auto entityFile = ResourceManager::Load<EntityFile>(classXML);
|
||||||
|
EntityFileParser parser(entityFile);
|
||||||
|
EntityID boostAssaultEntity = parser.MergeEntities(m_World);
|
||||||
|
m_World->SetParent(boostAssaultEntity, e.Victim.ID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string BoostSystem::determineClass(EntityWrapper player)
|
||||||
|
{
|
||||||
|
if (m_World->HasComponent(player.ID, "DashAbility")) {
|
||||||
|
return "BoostAssault";
|
||||||
|
}
|
||||||
|
if (m_World->HasComponent(player.ID, "DefenderShield")) {
|
||||||
|
return "BoostDefender";
|
||||||
|
}
|
||||||
|
if (m_World->HasComponent(player.ID, "SniperSprint")) {
|
||||||
|
return "BoostSniper";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
@@ -384,10 +384,12 @@ bool AssaultWeaponBehaviour::shoot(double damage)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for friendly fire
|
|
||||||
if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)m_Player["Team"]["Team"]) {
|
// Do Not Check for friendly fire
|
||||||
return false;
|
//// Check for friendly fire
|
||||||
}
|
//if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)m_Player["Team"]["Team"]) {
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
|
|
||||||
// Deal damage!
|
// Deal damage!
|
||||||
Events::PlayerDamage ePlayerDamage;
|
Events::PlayerDamage ePlayerDamage;
|
||||||
|
|||||||
Reference in New Issue
Block a user