Merge pull request #130 from teamfisk/AndersTest
CapturePointSystem fix, DamageIndicatorSystem fix
This commit is contained in:
@@ -14,11 +14,13 @@
|
|||||||
#include <glm/gtx/vector_angle.hpp>
|
#include <glm/gtx/vector_angle.hpp>
|
||||||
|
|
||||||
#include "Rendering/Util/CommonFunctions.h"
|
#include "Rendering/Util/CommonFunctions.h"
|
||||||
|
//#define INDICATOR_TEST
|
||||||
|
|
||||||
class DamageIndicatorSystem : public System
|
class DamageIndicatorSystem : public ImpureSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DamageIndicatorSystem(SystemParams params);
|
DamageIndicatorSystem(SystemParams params);
|
||||||
|
virtual void Update(double dt) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EventRelay<DamageIndicatorSystem, Events::PlayerDamage> m_EPlayerDamage;
|
EventRelay<DamageIndicatorSystem, Events::PlayerDamage> m_EPlayerDamage;
|
||||||
@@ -28,6 +30,20 @@ private:
|
|||||||
bool OnSetCamera(const Events::SetCamera& e);
|
bool OnSetCamera(const Events::SetCamera& e);
|
||||||
|
|
||||||
EntityID m_CurrentCamera = -1;
|
EntityID m_CurrentCamera = -1;
|
||||||
|
struct DamageIndicatorStruct {
|
||||||
|
EntityWrapper spriteEntity;
|
||||||
|
glm::vec3 enemyPosition;
|
||||||
|
DamageIndicatorStruct(EntityWrapper sprite, glm::vec3 pos)
|
||||||
|
: spriteEntity(sprite)
|
||||||
|
, enemyPosition(pos) {}
|
||||||
|
};
|
||||||
|
std::vector<DamageIndicatorStruct> updateDamageIndicatorVector;
|
||||||
|
float CalculateAngle(EntityWrapper player, glm::vec3 enemyPos);
|
||||||
|
|
||||||
|
//for tests
|
||||||
|
#ifdef INDICATOR_TEST
|
||||||
|
glm::vec3 DamageIndicatorTest(EntityWrapper player);
|
||||||
|
int m_TestVar = 0;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,27 +6,29 @@ CapturePointSystem::CapturePointSystem(SystemParams params)
|
|||||||
, PureSystem("CapturePoint")
|
, PureSystem("CapturePoint")
|
||||||
{
|
{
|
||||||
//subscribe/listenTo playerdamage,healthpickup events (using the eventBroker)
|
//subscribe/listenTo playerdamage,healthpickup events (using the eventBroker)
|
||||||
if (IsClient) {
|
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &CapturePointSystem::OnTriggerTouch);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &CapturePointSystem::OnTriggerTouch);
|
EVENT_SUBSCRIBE_MEMBER(m_ETriggerLeave, &CapturePointSystem::OnTriggerLeave);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ETriggerLeave, &CapturePointSystem::OnTriggerLeave);
|
EVENT_SUBSCRIBE_MEMBER(m_ECaptured, &CapturePointSystem::OnCaptured);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ECaptured, &CapturePointSystem::OnCaptured);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//here all capturepoints will update their component
|
//here all capturepoints will update their component
|
||||||
//NOTE: needs to run each frame, since we're possibly modifying the captureTimer for the capturePoints by dt
|
//NOTE: needs to run each frame, since we're possibly modifying the captureTimer for the capturePoints by dt
|
||||||
void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, ComponentWrapper& cCapturePoint, double dt)
|
void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, ComponentWrapper& cCapturePoint, double dt)
|
||||||
{
|
{
|
||||||
if (!IsClient) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_WinnerWasFound) {
|
if (m_WinnerWasFound) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const int capturePointNumber = cCapturePoint["CapturePointNumber"];
|
const int capturePointNumber = cCapturePoint["CapturePointNumber"];
|
||||||
const bool hasTeamComponent = capturePointEntity.HasComponent("Team");
|
const bool hasTeamComponent = capturePointEntity.HasComponent("Team");
|
||||||
|
|
||||||
|
if (m_NumberOfCapturePoints != 0) {
|
||||||
|
if (!m_CapturePointNumberToEntityMap[0].HasComponent("CapturePoint")) {
|
||||||
|
//if map has changed, the capturepoints has changed, now have to redo them
|
||||||
|
m_NumberOfCapturePoints = 0;
|
||||||
|
m_CapturePointNumberToEntityMap.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
//if point doesnt have a teamComponent yet, add one. since:
|
//if point doesnt have a teamComponent yet, add one. since:
|
||||||
//what if capture point has no team -> we cant get/use the team enum from it...
|
//what if capture point has no team -> we cant get/use the team enum from it...
|
||||||
if (!hasTeamComponent) {
|
if (!hasTeamComponent) {
|
||||||
@@ -71,8 +73,7 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
std::map<std::string, int> nextPossibleCapturePoint;
|
std::map<std::string, int> nextPossibleCapturePoint;
|
||||||
nextPossibleCapturePoint["Red"] = -1;
|
nextPossibleCapturePoint["Red"] = -1;
|
||||||
nextPossibleCapturePoint["Blue"] = -1;
|
nextPossibleCapturePoint["Blue"] = -1;
|
||||||
for (int i = 0; i < m_NumberOfCapturePoints; i++)
|
for (int i = 0; i < m_NumberOfCapturePoints; i++) {
|
||||||
{
|
|
||||||
if (!m_CapturePointNumberToEntityMap[i].HasComponent("Team")) {
|
if (!m_CapturePointNumberToEntityMap[i].HasComponent("Team")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -84,8 +85,7 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
nextPossibleCapturePoint["Blue"] = i + 1;
|
nextPossibleCapturePoint["Blue"] = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = m_NumberOfCapturePoints - 1; i >= 0; i--)
|
for (int i = m_NumberOfCapturePoints - 1; i >= 0; i--) {
|
||||||
{
|
|
||||||
if (!m_CapturePointNumberToEntityMap[i].HasComponent("Team")) {
|
if (!m_CapturePointNumberToEntityMap[i].HasComponent("Team")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -100,8 +100,7 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
|
|
||||||
//reset timers and reset the bool that triggers this
|
//reset timers and reset the bool that triggers this
|
||||||
if (m_ResetTimers) {
|
if (m_ResetTimers) {
|
||||||
for (int i = 0; i < m_NumberOfCapturePoints; i++)
|
for (int i = 0; i < m_NumberOfCapturePoints; i++) {
|
||||||
{
|
|
||||||
ComponentWrapper& capturePoint = m_CapturePointNumberToEntityMap[i]["CapturePoint"];
|
ComponentWrapper& capturePoint = m_CapturePointNumberToEntityMap[i]["CapturePoint"];
|
||||||
if ((int)capturePoint["CapturePointNumber"] != nextPossibleCapturePoint["Red"] &&
|
if ((int)capturePoint["CapturePointNumber"] != nextPossibleCapturePoint["Red"] &&
|
||||||
(int)capturePoint["CapturePointNumber"] != nextPossibleCapturePoint["Blue"]) {
|
(int)capturePoint["CapturePointNumber"] != nextPossibleCapturePoint["Blue"]) {
|
||||||
@@ -116,8 +115,7 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check how many players are standing inside and are healthy
|
//check how many players are standing inside and are healthy
|
||||||
for (size_t i = m_ETriggerTouchVector.size(); i > 0; i--)
|
for (size_t i = m_ETriggerTouchVector.size(); i > 0; i--) {
|
||||||
{
|
|
||||||
auto triggerTouched = m_ETriggerTouchVector[i - 1];
|
auto triggerTouched = m_ETriggerTouchVector[i - 1];
|
||||||
if (std::get<1>(triggerTouched) == capturePointEntity) {
|
if (std::get<1>(triggerTouched) == capturePointEntity) {
|
||||||
//some player has touched this - lets figure out: what team, health
|
//some player has touched this - lets figure out: what team, health
|
||||||
@@ -176,8 +174,8 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
cCapturePoint["CaptureTimer"] = (double)cCapturePoint["CaptureTimer"] + timerDeltaChange;
|
cCapturePoint["CaptureTimer"] = (double)cCapturePoint["CaptureTimer"] + timerDeltaChange;
|
||||||
}
|
}
|
||||||
//if capturePoint is owned by the team, and the other team has been trying to take it, then increase/decrease the timer towards 0.0
|
//if capturePoint is owned by the team, and the other team has been trying to take it, then increase/decrease the timer towards 0.0
|
||||||
if ((ownedBy == currentTeam && currentTeam == redTeam && (double)cCapturePoint["CaptureTimer"] < 0.0) ||
|
if ((ownedBy == currentTeam && currentTeam == redTeam && (double)cCapturePoint["CaptureTimer"] < captureTimeToTakeOver) ||
|
||||||
(ownedBy == currentTeam && currentTeam == blueTeam && (double)cCapturePoint["CaptureTimer"] > 0.0)) {
|
(ownedBy == currentTeam && currentTeam == blueTeam && (double)cCapturePoint["CaptureTimer"] > -captureTimeToTakeOver)) {
|
||||||
cCapturePoint["CaptureTimer"] = (double)cCapturePoint["CaptureTimer"] + timerDeltaChange;
|
cCapturePoint["CaptureTimer"] = (double)cCapturePoint["CaptureTimer"] + timerDeltaChange;
|
||||||
}
|
}
|
||||||
//check if captureTimer > captureTimeToTakeOver and if so change owner and publish the eCaptured event
|
//check if captureTimer > captureTimeToTakeOver and if so change owner and publish the eCaptured event
|
||||||
@@ -195,17 +193,14 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
|
|
||||||
//check for possible winCondition = check if the homebase is owned by the other team
|
//check for possible winCondition = check if the homebase is owned by the other team
|
||||||
bool checkForWinner = false;
|
bool checkForWinner = false;
|
||||||
if (capturePointNumber == m_RedTeamHomeCapturePoint && ownedBy != redTeam)
|
if (capturePointNumber == m_RedTeamHomeCapturePoint && ownedBy != redTeam) {
|
||||||
{
|
|
||||||
checkForWinner = true;
|
checkForWinner = true;
|
||||||
}
|
}
|
||||||
if (capturePointNumber == m_BlueTeamHomeCapturePoint && ownedBy != blueTeam)
|
if (capturePointNumber == m_BlueTeamHomeCapturePoint && ownedBy != blueTeam) {
|
||||||
{
|
|
||||||
checkForWinner = true;
|
checkForWinner = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkForWinner && !m_WinnerWasFound)
|
if (checkForWinner && !m_WinnerWasFound) {
|
||||||
{
|
|
||||||
//publish Win event
|
//publish Win event
|
||||||
Events::Win e;
|
Events::Win e;
|
||||||
e.TeamThatWon = ownedBy;
|
e.TeamThatWon = ownedBy;
|
||||||
@@ -224,8 +219,7 @@ bool CapturePointSystem::OnTriggerTouch(const Events::TriggerTouch& e)
|
|||||||
|
|
||||||
bool CapturePointSystem::OnTriggerLeave(const Events::TriggerLeave& e)
|
bool CapturePointSystem::OnTriggerLeave(const Events::TriggerLeave& e)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < m_ETriggerTouchVector.size(); i++)
|
for (size_t i = 0; i < m_ETriggerTouchVector.size(); i++) {
|
||||||
{
|
|
||||||
auto triggerTouched = m_ETriggerTouchVector[i];
|
auto triggerTouched = m_ETriggerTouchVector[i];
|
||||||
if (std::get<0>(triggerTouched) == e.Entity && std::get<1>(triggerTouched) == e.Trigger) {
|
if (std::get<0>(triggerTouched) == e.Entity && std::get<1>(triggerTouched) == e.Trigger) {
|
||||||
m_ETriggerTouchVector.erase(m_ETriggerTouchVector.begin() + i);
|
m_ETriggerTouchVector.erase(m_ETriggerTouchVector.begin() + i);
|
||||||
|
|||||||
@@ -12,15 +12,26 @@ DamageIndicatorSystem::DamageIndicatorSystem(SystemParams params)
|
|||||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/DamageIndicator.xml");
|
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/DamageIndicator.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DamageIndicatorSystem::Update(double dt) {
|
||||||
|
if (!IsServer) {
|
||||||
|
for (auto& iter = updateDamageIndicatorVector.begin(); iter != updateDamageIndicatorVector.end(); iter++) {
|
||||||
|
if (!iter->spriteEntity.Valid()) {
|
||||||
|
updateDamageIndicatorVector.erase(iter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
auto angleBetweenVectors = CalculateAngle(LocalPlayer, iter->enemyPosition);
|
||||||
|
//simply set the rotation z-wise to the angleBetweenVectors
|
||||||
|
iter->spriteEntity["Transform"]["Orientation"] = glm::vec3(0, 0, angleBetweenVectors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool DamageIndicatorSystem::OnPlayerDamage(Events::PlayerDamage& e)
|
bool DamageIndicatorSystem::OnPlayerDamage(Events::PlayerDamage& e)
|
||||||
{
|
{
|
||||||
if (m_CurrentCamera == EntityID_Invalid) {
|
if (m_CurrentCamera == EntityID_Invalid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (e.Victim != LocalPlayer) {
|
|
||||||
// return false;
|
|
||||||
//}
|
|
||||||
if (e.Victim.Valid() && e.Victim != LocalPlayer && !e.Victim.IsChildOf(LocalPlayer)) {
|
if (e.Victim.Valid() && e.Victim != LocalPlayer && !e.Victim.IsChildOf(LocalPlayer)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -29,34 +40,13 @@ bool DamageIndicatorSystem::OnPlayerDamage(Events::PlayerDamage& e)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//grab players direction
|
glm::vec3 inflictorPos = e.Inflictor["Transform"]["Position"];
|
||||||
auto playerOrientation = glm::quat((glm::vec3)e.Victim["Transform"]["Orientation"]);
|
//if testing
|
||||||
|
#ifdef INDICATOR_TEST
|
||||||
|
inflictorPos = DamageIndicatorTest(e.Victim);
|
||||||
|
#endif
|
||||||
|
|
||||||
//get the position vectors, but ignore the y-height
|
float angleBetweenVectors = CalculateAngle(e.Victim, inflictorPos);
|
||||||
auto enemyPosition = (glm::vec3)e.Inflictor["Transform"]["Position"];
|
|
||||||
auto playerPosition = (glm::vec3)e.Victim["Transform"]["Position"];
|
|
||||||
enemyPosition.y = 0.0f;
|
|
||||||
playerPosition.y = 0.0f;
|
|
||||||
|
|
||||||
//calculate the enemy to player vector
|
|
||||||
auto enemyPlayerVector = glm::normalize(playerPosition - enemyPosition);
|
|
||||||
|
|
||||||
//get angle from players current rotation, this angle is how much you rotate around the y-axis
|
|
||||||
auto playerAngle = glm::angle(playerOrientation);
|
|
||||||
auto playerRotationVector = glm::normalize(glm::rotateY(glm::vec3(0, 0, 1), playerAngle));
|
|
||||||
|
|
||||||
//dot product of players direction-vector and enemys-to-playervector will give the cos of the angle between the vectors
|
|
||||||
auto playerRotationDot = glm::dot(playerRotationVector, enemyPlayerVector);
|
|
||||||
//to get the angle between the vectors just do cos-inverse
|
|
||||||
auto angleBetweenVectors = glm::acos(playerRotationDot);
|
|
||||||
|
|
||||||
//rotate the direction-vector 90 degrees to get the players side-vector
|
|
||||||
auto playerSideVector = glm::normalize(glm::rotateY(glm::vec3(0, 0, 1), playerAngle + 1.57f));
|
|
||||||
//dot of sidevector positive = enemy is on the right side, dot sidevector negative = left side
|
|
||||||
auto playerSideVectorDot = glm::dot(playerSideVector, enemyPlayerVector);
|
|
||||||
if (playerSideVectorDot < 0) {
|
|
||||||
angleBetweenVectors = -angleBetweenVectors;
|
|
||||||
}
|
|
||||||
|
|
||||||
//load & set the "2d" sprite
|
//load & set the "2d" sprite
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/DamageIndicator.xml");
|
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/DamageIndicator.xml");
|
||||||
@@ -67,6 +57,10 @@ bool DamageIndicatorSystem::OnPlayerDamage(Events::PlayerDamage& e)
|
|||||||
//simply set the rotation z-wise to the angleBetweenVectors
|
//simply set the rotation z-wise to the angleBetweenVectors
|
||||||
spriteWrapper["Transform"]["Orientation"] = glm::vec3(0, 0, angleBetweenVectors);
|
spriteWrapper["Transform"]["Orientation"] = glm::vec3(0, 0, angleBetweenVectors);
|
||||||
|
|
||||||
|
if (!IsServer) {
|
||||||
|
updateDamageIndicatorVector.emplace_back(spriteWrapper, inflictorPos);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,3 +68,82 @@ bool DamageIndicatorSystem::OnSetCamera(const Events::SetCamera& e) {
|
|||||||
m_CurrentCamera = e.CameraEntity.ID;
|
m_CurrentCamera = e.CameraEntity.ID;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float DamageIndicatorSystem::CalculateAngle(EntityWrapper player, glm::vec3 enemyPos) {
|
||||||
|
//grab players direction
|
||||||
|
auto playerOrientation = glm::quat((glm::vec3)player["Transform"]["Orientation"]);
|
||||||
|
|
||||||
|
//get the position vectors, but ignore the y-height
|
||||||
|
auto enemyPosition = enemyPos;
|
||||||
|
auto playerPosition = (glm::vec3)player["Transform"]["Position"];
|
||||||
|
enemyPosition.y = 0.0f;
|
||||||
|
playerPosition.y = 0.0f;
|
||||||
|
|
||||||
|
//calculate the enemy to player vector
|
||||||
|
auto enemyPlayerVector = glm::normalize(playerPosition - enemyPosition);
|
||||||
|
|
||||||
|
//get the rotationvector relative to the z-axis
|
||||||
|
auto rotationVectorVec3 = glm::vec3(glm::toMat4(Transform::AbsoluteOrientation(player))*glm::vec4(0, 0, 1, 0));
|
||||||
|
//rotate the direction-vector 90 degrees to get the players side-vector
|
||||||
|
auto playerSideVector = glm::vec3(glm::rotateY(rotationVectorVec3, 1.57f));
|
||||||
|
|
||||||
|
//dot product of players direction-vector and enemys-to-playervector will give the cos of the angle between the vectors
|
||||||
|
auto playerRotationDot = glm::dot(rotationVectorVec3, enemyPlayerVector);
|
||||||
|
//to get the angle between the vectors just do cos-inverse
|
||||||
|
auto angleBetweenVectors = glm::acos(playerRotationDot);
|
||||||
|
|
||||||
|
//dot of sidevector positive = enemy is on the right side, dot sidevector negative = left side
|
||||||
|
auto playerSideVectorDot = glm::dot(playerSideVector, enemyPlayerVector);
|
||||||
|
if (playerSideVectorDot < 0) {
|
||||||
|
angleBetweenVectors = -angleBetweenVectors;
|
||||||
|
}
|
||||||
|
|
||||||
|
return angleBetweenVectors;
|
||||||
|
}
|
||||||
|
#ifdef INDICATOR_TEST
|
||||||
|
glm::vec3 DamageIndicatorSystem::DamageIndicatorTest(EntityWrapper player) {
|
||||||
|
auto currentPos = (glm::vec3)player["Transform"]["Position"];
|
||||||
|
|
||||||
|
auto testVar = 1;
|
||||||
|
auto testVar2 = 1;
|
||||||
|
if (m_TestVar % 4 == 0) {
|
||||||
|
testVar = -1;
|
||||||
|
testVar2 = 1;
|
||||||
|
}
|
||||||
|
if (m_TestVar % 4 == 1) {
|
||||||
|
testVar = 1;
|
||||||
|
testVar2 = 1;
|
||||||
|
}
|
||||||
|
if (m_TestVar % 4 == 2) {
|
||||||
|
testVar *= -1;
|
||||||
|
testVar2 = -1;
|
||||||
|
}
|
||||||
|
if (m_TestVar % 4 == 3) {
|
||||||
|
testVar = 1;
|
||||||
|
testVar2 = -1;
|
||||||
|
}
|
||||||
|
m_TestVar++;
|
||||||
|
|
||||||
|
auto inflictorPos = glm::vec3(currentPos.x + testVar*6.0f, currentPos.y, currentPos.z + testVar2*6.0f);
|
||||||
|
|
||||||
|
//load the explosioneffect XML
|
||||||
|
auto deathEffect = ResourceManager::Load<EntityFile>("Schema/Entities/PlayerDeathExplosionWithCamera.xml");
|
||||||
|
EntityFileParser parser(deathEffect);
|
||||||
|
EntityID deathEffectID = parser.MergeEntities(m_World);
|
||||||
|
EntityWrapper deathEffectEW = EntityWrapper(m_World, deathEffectID);
|
||||||
|
|
||||||
|
//components that we need from player
|
||||||
|
auto playerModel = player.FirstChildByName("PlayerModel");
|
||||||
|
auto playerEntityModel = playerModel["Model"];
|
||||||
|
auto playerEntityAnimation = playerModel["Animation"];
|
||||||
|
|
||||||
|
//copy the data from player to explosioneffectmodel
|
||||||
|
playerEntityModel.Copy(deathEffectEW["Model"]);
|
||||||
|
playerEntityAnimation.Copy(deathEffectEW["Animation"]);
|
||||||
|
|
||||||
|
//copy the models position,orientation
|
||||||
|
deathEffectEW["Transform"]["Position"] = inflictorPos;
|
||||||
|
deathEffectEW["Transform"]["Orientation"] = (glm::vec3)player["Transform"]["Orientation"];
|
||||||
|
return inflictorPos;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -33,9 +33,8 @@ void PlayerDeathSystem::createDeathEffect(EntityWrapper player)
|
|||||||
EntityWrapper deathEffectEW = EntityWrapper(m_World, deathEffectID);
|
EntityWrapper deathEffectEW = EntityWrapper(m_World, deathEffectID);
|
||||||
|
|
||||||
//components that we need from player
|
//components that we need from player
|
||||||
auto playerCamera = player.FirstChildByName("Camera");
|
|
||||||
auto playerModel = player.FirstChildByName("PlayerModel");
|
auto playerModel = player.FirstChildByName("PlayerModel");
|
||||||
if (!playerCamera.Valid() || !playerModel.Valid()) {
|
if (!playerModel.Valid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!playerModel.HasComponent("Model") || !playerModel.HasComponent("Animation")) {
|
if (!playerModel.HasComponent("Model") || !playerModel.HasComponent("Animation")) {
|
||||||
@@ -44,7 +43,7 @@ void PlayerDeathSystem::createDeathEffect(EntityWrapper player)
|
|||||||
auto playerEntityModel = playerModel["Model"];
|
auto playerEntityModel = playerModel["Model"];
|
||||||
auto playerEntityAnimation = playerModel["Animation"];
|
auto playerEntityAnimation = playerModel["Animation"];
|
||||||
|
|
||||||
//copy the data from player to explisioneffectmodel
|
//copy the data from player to explosioneffectmodel
|
||||||
playerEntityModel.Copy(deathEffectEW["Model"]);
|
playerEntityModel.Copy(deathEffectEW["Model"]);
|
||||||
playerEntityAnimation.Copy(deathEffectEW["Animation"]);
|
playerEntityAnimation.Copy(deathEffectEW["Animation"]);
|
||||||
//freeze the animation
|
//freeze the animation
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "Core/EventBroker.h"
|
#include "Core/EventBroker.h"
|
||||||
#include "Rendering/Renderer.h"
|
#include "Rendering/Renderer.h"
|
||||||
#include "Core/InputManager.h"
|
#include "Core/InputManager.h"
|
||||||
#include "GUI/Frame.h"
|
|
||||||
#include "Core/World.h"
|
#include "Core/World.h"
|
||||||
#include "Input/InputProxy.h"
|
#include "Input/InputProxy.h"
|
||||||
#include "Input/KeyboardInputHandler.h"
|
#include "Input/KeyboardInputHandler.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user