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

This commit is contained in:
2016-02-11 17:25:37 +01:00
45 changed files with 1113 additions and 191 deletions
+5
View File
@@ -12,12 +12,14 @@
#include "Systems/PlayerDeathSystem.h"
#include "Core/EntityFileWriter.h"
#include "Game/Systems/CapturePointSystem.h"
#include "Game/Systems/CapturePointHUDSystem.h"
#include "Game/Systems/PickupSpawnSystem.h"
#include "Game/Systems/Weapon/WeaponSystem.h"
#include "Rendering/AnimationSystem.h"
#include "Game/Systems/PlayerHUDSystem.h"
#include "Rendering/BoneAttachmentSystem.h"
#include "Game/Systems/LifetimeSystem.h"
#include "../Engine/Core/UniformScaleSystem.h"
#include "Rendering/AnimationSystem.h"
#include "Network/MultiplayerSnapshotFilter.h"
@@ -30,6 +32,7 @@ Game::Game(int argc, char* argv[])
ResourceManager::RegisterType<Model>("Model");
ResourceManager::RegisterType<RawModel>("RawModel");
ResourceManager::RegisterType<Texture>("Texture");
ResourceManager::RegisterType<PNG>("Png");
ResourceManager::RegisterType<ShaderProgram>("ShaderProgram");
ResourceManager::RegisterType<EntityFile>("EntityFile");
ResourceManager::RegisterType<Font>("FontFile");
@@ -118,6 +121,7 @@ Game::Game(int argc, char* argv[])
m_SystemPipeline->AddSystem<WeaponSystem>(updateOrderLevel, m_Renderer, m_OctreeCollision);
m_SystemPipeline->AddSystem<LifetimeSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<CapturePointSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<CapturePointHUDSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<PickupSpawnSystem>(updateOrderLevel);
// Populate Octree with collidables
++updateOrderLevel;
@@ -125,6 +129,7 @@ Game::Game(int argc, char* argv[])
m_SystemPipeline->AddSystem<FillOctreeSystem>(updateOrderLevel, m_OctreeTrigger, "Player");
m_SystemPipeline->AddSystem<FillFrustumOctreeSystem>(updateOrderLevel, m_OctreeFrustrumCulling);
m_SystemPipeline->AddSystem<AnimationSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<UniformScaleSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<PlayerHUDSystem>(updateOrderLevel);
// Collision and TriggerSystem should update after player.
++updateOrderLevel;
@@ -0,0 +1,52 @@
#include "Systems/CapturePointHUDSystem.h"
CapturePointHUDSystem::CapturePointHUDSystem(SystemParams params)
: System(params)
, ImpureSystem()
{
}
void CapturePointHUDSystem::Update(double dt)
{
bool LoadCheck = true;
int redTeam;
int blueTeam;
int spectatorTeam;
auto CapturePointHUDElements = m_World->GetComponents("CapturePointHUD");
auto CapturePoints = m_World->GetComponents("CapturePoint");
for (auto& cCapturePointHUD : *CapturePointHUDElements) {
int HUD_ID = cCapturePointHUD["CapturePointNumber"];
EntityWrapper entityHUD = EntityWrapper(m_World, cCapturePointHUD.EntityID);
EntityWrapper entityHUDparent = entityHUD.Parent();
for (auto& cCapturePoint : *CapturePoints) {
EntityWrapper entityCP = EntityWrapper(m_World, cCapturePoint.EntityID);
//Check if the HUD corresponds to the Capture Point Number
if (HUD_ID == (int)entityCP["CapturePoint"]["CapturePointNumber"]) {
ComponentWrapper& teamComponent = entityCP["Team"];
if (LoadCheck) {
redTeam = (int)teamComponent["Team"].Enum("Red");
blueTeam = (int)teamComponent["Team"].Enum("Blue");
spectatorTeam = (int)teamComponent["Team"].Enum("Spectator");
LoadCheck = false;
}
//Color hud with team color
auto capturePointTeam = (int)teamComponent["Team"];
entityHUDparent["Sprite"]["Color"] = capturePointTeam == blueTeam ? glm::vec4(0, 0.2f, 1, 0.7) : capturePointTeam == redTeam ? glm::vec4(1, 0.2f, 0, 0.7) : glm::vec4(1, 1, 1, 0.3);
//Progress is scaled with time
double currentCaptureTime = (double)entityCP["CapturePoint"]["CaptureTimer"];
double progress = glm::abs(currentCaptureTime)/15.0;
int currentCapturingTeam = currentCaptureTime > 0 ? redTeam : currentCaptureTime < 0 ? blueTeam : spectatorTeam;
((glm::vec3&)entityHUD["Transform"]["Orientation"]).z = currentCapturingTeam == redTeam ? glm::half_pi<float>()+glm::pi<float>() : glm::half_pi<float>();
glm::vec4 fillColor = currentCapturingTeam == redTeam ? glm::vec4(1, 0.2f, 0, 0.7) : glm::vec4(0, 0.2f, 1, 0.7);
entityHUD["Fill"]["Color"] = fillColor;
entityHUD["Fill"]["Percentage"] = progress;
}
}
}
}
+7 -1
View File
@@ -110,9 +110,15 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
//you cant jump and dash at the same time - since there is no friction in the air and we would thus dash much further in the air
if (!controller->PlayerIsDashing() && controller->Jumping() && !controller->Crouching() && (isOnGround || !controller->DoubleJumping())) {
(bool)cPhysics["IsOnGround"] = false;
if (velocity.y == 0.f) {
if (isOnGround) {
controller->SetDoubleJumping(false);
} else {
//put a hexagon at the players feet
auto hexagonEffect = ResourceManager::Load<EntityFile>("Schema/Entities/DoubleJumpHexagon.xml");
EntityFileParser parser(hexagonEffect);
EntityID hexagonEffectID = parser.MergeEntities(m_World);
EntityWrapper hexagonEW = EntityWrapper(m_World, hexagonEffectID);
hexagonEW["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
controller->SetDoubleJumping(true);
Events::DoubleJump e;
m_EventBroker->Publish(e);