Merge remote-tracking branch 'origin/Menu' into WeaponSystem

# Conflicts:
#	resources/Schema/Entities/Player.xml
#	resources/Schema/Types/Entity.xsd
#	src/Game/Systems/PlayerSpawnSystem.cpp
This commit is contained in:
2016-02-12 07:18:20 +01:00
13 changed files with 1593 additions and 12 deletions
+39
View File
@@ -0,0 +1,39 @@
#ifndef KillFeedSystem_h__
#define KillFeedSystem_h__
#include "../../Engine/Core/System.h"
#include "../../Engine/GLM.h"
#include "Core/EPlayerDeath.h"
class KillFeedSystem : public ImpureSystem
{
public:
KillFeedSystem(SystemParams params)
: System(params)
{
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDeath, &KillFeedSystem::OnPlayerDeath);
}
virtual void Update(double dt) override;
private:
EventRelay<KillFeedSystem, Events::PlayerDeath> m_EPlayerDeath;
bool KillFeedSystem::OnPlayerDeath(Events::PlayerDeath& e);
struct KillFeedInfo
{
std::string Content;
glm::vec4 Color;
float TimeToLive = 5.f;
};
std::list<KillFeedInfo> m_DeathQueue;
};
#endif
+1
View File
@@ -41,4 +41,5 @@
<xs:include schemaLocation="Components/Shielded.xsd"/>
<xs:include schemaLocation="Components/CapturePointHUD.xsd"/>
<xs:include schemaLocation="Components/AmmunitionHUD.xsd"/>
<xs:include schemaLocation="Components/KillFeed.xsd"/>
</xs:schema>
+3
View File
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<KillFeed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="KillFeed.xsd">
</KillFeed>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:element name="KillFeed">
<xs:annotation>
<xs:documentation>HUD element for tracking the 3 last kills, printed on the children with the names "KillFeed1", "KillFeed2", "KillFeed3"</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Text xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Text.xsd">
<Content>Text</Content>
<Content></Content>
<Resource></Resource>
<Color R="1" G="1" B="1" A="1"/>
<Visible>true</Visible>
+255
View File
@@ -0,0 +1,255 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="Player" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:AABB>
<Origin X="0" Y="0.772000015" Z="0"/>
<Size X="1" Y="1.60000002" Z="1"/>
</c:AABB>
<c:AssaultWeapon>
<RPM>600</RPM>
</c:AssaultWeapon>
<c:Collidable/>
<c:DashAbility/>
<c:Health/>
<c:Physics>
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
</c:Physics>
<c:Player>
<MovementSpeed>5</MovementSpeed>
</c:Player>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Transform>
<Position X="0" Y="0.0288832653" Z="2.64837074"/>
</c:Transform>
</Components>
<Children>
<Entity name="Camera">
<Components>
<c:Camera/>
<c:Transform>
<Position X="0" Y="1.27700007" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="PlayerName">
<Components>
<c:Text>
<Resource>Fonts/DroidSans.ttf,100</Resource>
<Color A="1" B="0" G="1" R="0"/>
</c:Text>
<c:Transform>
<Position X="0.100000001" Y="0.248000011" Z="-0.248000011"/>
<Scale X="0.100000001" Y="0.113000005" Z="0.5"/>
<Orientation X="0" Y="3.14199996" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="CameraModel">
<Components>
<c:Model>
<Resource>Models/Widgets/Camera.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0" Y="0.0331346765" Z="-0.0792061687"/>
<Scale X="1.30000007" Y="1.50000012" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="HUD">
<Components>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
</c:Transform>
</Components>
<Children>
<Entity name="HealthBar">
<Components>
<c:Fill>
<Percentage>1</Percentage>
<Color A="0" B="1" G="0" R="0"/>
</c:Fill>
<c:HealthHUD/>
<c:Model>
<Resource>Models/Core/UnitHexagon.mesh</Resource>
<Color A="1" B="0.70588237" G="0.70588237" R="0.70588237"/>
</c:Model>
<c:Transform>
<Position X="-0.383000016" Y="-0.185000002" Z="0"/>
<Scale X="0.150000006" Y="0.150000006" Z="0.150000006"/>
<Orientation X="0" Y="0.594000041" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Crosshair">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
<DepthSort>false</DepthSort>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.200000003"/>
<Scale X="0.0250000004" Y="0.0250000004" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Hands">
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>0.28963486380924053</Time1>
<Speed1>1</Speed1>
</c:Animation>
<c:Model>
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
<Transparent>true</Transparent>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponModel">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0.120430455" Y="-0.231800437" Z="-0.181454748"/>
<Orientation X="0.0104047749" Y="-0.00268166233" Z="0.042844031"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00325386273" Y="0.0970000029" Z="-0.843000054"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="FirstPersonReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/WeaponReloadEffect.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="ThirdPersonCamera">
<Components>
<c:Camera/>
<c:Model>
<Resource>Models/Widgets/Camera.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="-0.284000009" Y="1.83800006" Z="1.18900001"/>
<Orientation X="5.95600033" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="PlayerModel">
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>0.42156525436696768</Time1>
<Speed1>1</Speed1>
</c:Animation>
<c:AnimationOffset>
<AnimationName>AimRifle</AnimationName>
<Time>0.5</Time>
</c:AnimationOffset>
<c:HiddenForLocalPlayer/>
<c:Model>
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="ThirdPersonWeaponModel">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0.160716802" Y="1.02800739" Z="-0.215931982"/>
<Orientation X="-0.0627654716" Y="-0.0450839326" Z="0.119217664"/>
</c:Transform>
</Components>
<Children>
<Entity name="ThirdPersonWeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00644115033" Y="0.096679531" Z="-0.436609417"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="AABBStanding">
<Components>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="0.427450985" B="1" G="1" R="1"/>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0" Y="0.772000015" Z="0"/>
<Scale X="1" Y="1.60000002" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AABBCrouching">
<Components>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="0.745098054" B="1" G="0" R="1"/>
<Visible>false</Visible>
</c:Model>
<c:Transform>
<Position X="0" Y="0.772000015" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
File diff suppressed because it is too large Load Diff
+60 -6
View File
@@ -306,13 +306,67 @@
</Entity>
</Children>
</Entity>
<Entity name="KillFeed">
<Components>
<c:KillFeed/>
<c:Transform>
<Position X="0.486000031" Y="0.266000003" Z="0"/>
<Scale X="0.00999999978" Y="0.00999999978" Z="0.00999999978"/>
</c:Transform>
</Components>
<Children>
<Entity name="KillFeed1">
<Components>
<c:Text>
<Content></Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Alignment>
<Right/>
</Alignment>
</c:Text>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="KillFeed2">
<Components>
<c:Text>
<Content></Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Alignment>
<Right/>
</Alignment>
</c:Text>
<c:Transform>
<Position X="0" Y="-1" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="KillFeed3">
<Components>
<c:Text>
<Content></Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Alignment>
<Right/>
</Alignment>
</c:Text>
<c:Transform>
<Position X="0" Y="-2" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="Hands">
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>0.1719161089749548</Time1>
<Time1>1.6050530664521858</Time1>
<Speed1>1</Speed1>
</c:Animation>
<c:Model>
@@ -332,8 +386,8 @@
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0.120430604" Y="-0.229735136" Z="-0.181454614"/>
<Orientation X="0.0104046864" Y="-0.00268157595" Z="0.0428441279"/>
<Position X="0.12043035" Y="-0.234149337" Z="-0.181454644"/>
<Orientation X="0.0104045281" Y="-0.00268131681" Z="0.0428438708"/>
</c:Transform>
</Components>
<Children>
@@ -439,7 +493,7 @@
<Components>
<c:Animation>
<AnimationName1>Idle</AnimationName1>
<Time1>1.8038469763698401</Time1>
<Time1>1.620305457513453</Time1>
<Speed1>1</Speed1>
</c:Animation>
<c:AnimationOffset>
@@ -464,8 +518,8 @@
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.158596605" Y="1.02875519" Z="-0.215406924"/>
<Orientation X="-0.0626692027" Y="-0.0361935981" Z="0.120094992"/>
<Position X="0.160351232" Y="1.02591991" Z="-0.215102971"/>
<Orientation X="-0.0627480298" Y="-0.0432248674" Z="0.119431816"/>
</c:Transform>
</Components>
<Children>
+1
View File
@@ -44,6 +44,7 @@
<xs:element ref="c:Shielded" minOccurs="0"/>
<xs:element ref="c:CapturePointHUD" minOccurs="0"/>
<xs:element ref="c:AmmunitionHUD" minOccurs="0"/>
<xs:element ref="c:KillFeed" minOccurs="0"/>
<xs:element ref="c:Sprite" minOccurs="0"/>
<xs:element ref="c:AnimationOffset" minOccurs="0"/>
</xs:all>
+2
View File
@@ -25,6 +25,7 @@
#include "Rendering/AnimationSystem.h"
#include "Network/MultiplayerSnapshotFilter.h"
#include "Game/Systems/AmmunitionHUDSystem.h"
#include "Game/Systems/KillFeedSystem.h"
Game::Game(int argc, char* argv[])
@@ -130,6 +131,7 @@ Game::Game(int argc, char* argv[])
m_SystemPipeline->AddSystem<AmmoPickupSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<DamageIndicatorSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<AmmunitionHUDSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<KillFeedSystem>(updateOrderLevel);
// Populate Octree with collidables
++updateOrderLevel;
m_SystemPipeline->AddSystem<FillOctreeSystem>(updateOrderLevel, m_OctreeCollision, "Collidable");
+1 -1
View File
@@ -27,7 +27,7 @@ void HealthHUDSystem::Update(double dt)
s = s + "/";
s = s + std::to_string((int)(double)entityIDParent["Health"]["MaxHealth"]);
float healthPercentage = (double)entityIDParent["Health"]["Health"]/(double)entityIDParent["Health"]["MaxHealth"];
(glm::vec4&)entity["Text"]["Color"] = glm::vec4(1.0 - healthPercentage, 0.f, healthPercentage, glm::vec4(entity["Text"]["Color"]).a);
//(glm::vec4&)entity["Text"]["Color"] = glm::vec4(1.0 - healthPercentage, 0.f, healthPercentage, glm::vec4(entity["Text"]["Color"]).a);
entity["Text"]["Content"] = s;
}
+80
View File
@@ -0,0 +1,80 @@
#include "Game/Systems/KillFeedSystem.h"
void KillFeedSystem::Update(double dt)
{
auto killFeeds = m_World->GetComponents("KillFeed");
if (killFeeds == nullptr) {
return;
}
for (auto& killFeedComponent : *killFeeds) {
EntityWrapper entity = EntityWrapper(m_World, killFeedComponent.EntityID);
for (int i = 1; i <= 3; i++) {
EntityWrapper child = entity.FirstChildByName("KillFeed" + std::to_string(i));
if (child.HasComponent("Text")) {
(std::string&)child["Text"]["Content"] = "";
}
}
int feedIndex = 1;
for (auto it = m_DeathQueue.begin(); it != m_DeathQueue.end(); ) {
bool remove = false;
EntityWrapper child = entity.FirstChildByName("KillFeed" + std::to_string(feedIndex));
if (child.HasComponent("Text")) {
(std::string&)child["Text"]["Content"] = (*it).Content;
(glm::vec4&)child["Text"]["Color"] = (*it).Color;
(*it).TimeToLive -= dt;
if ((*it).TimeToLive <= 0.f) {
(std::string&)child["Text"]["Content"] = "";
(glm::vec4&)child["Text"]["Color"] = (*it).Color;
remove = true;
}
}
feedIndex++;
if(feedIndex > 3) {
break;
}
if(remove) {
it = m_DeathQueue.erase(it);
} else {
it++;
}
}
}
}
bool KillFeedSystem::OnPlayerDeath(Events::PlayerDeath& e)
{
KillFeedInfo kfInfo;
if (e.Player.HasComponent("Team")) {
int red = e.Player["Team"].Enum("Team", "Red");
int blue = e.Player["Team"].Enum("Team", "Blue");
if ((int)e.Player["Team"]["Team"] == red) {
kfInfo.Content = "Blue Player killed Red Player";
kfInfo.Color = glm::vec4(0.f, 0.2f, 1.f, 0.8f);
m_DeathQueue.push_back(kfInfo);
} else if ((int)e.Player["Team"]["Team"] == blue) {
kfInfo.Content = "Red Player killed blue Player";
kfInfo.Color = glm::vec4(1.f, 0.f, 0.f, 0.8f);
m_DeathQueue.push_back(kfInfo);
}
}
if(m_DeathQueue.size() > 3) {
m_DeathQueue.pop_front();
}
return true;
}
+4 -4
View File
@@ -181,10 +181,10 @@ bool PlayerSpawnSystem::OnPlayerDeath(Events::PlayerDeath& e)
return false;
}
SpawnRequest req;
req.PlayerID = m_PlayerIDs.at(e.Player.ID);
req.Team = cTeam["Team"];
m_SpawnRequests.push_back(req);
SpawnRequest req;
req.PlayerID = m_PlayerIDs.at(e.Player.ID);
req.Team = cTeam["Team"];
m_SpawnRequests.push_back(req);
return true;
}