Fix for PlayerSpawnSystem

This commit is contained in:
verysecrethero
2016-02-23 13:55:24 +01:00
parent 99cdcdf289
commit 25a7240962
2 changed files with 39 additions and 1 deletions
@@ -14,6 +14,44 @@ DamageIndicatorSystem::DamageIndicatorSystem(SystemParams params)
bool DamageIndicatorSystem::OnPlayerDamage(Events::PlayerDamage& e)
{
//TEST
auto currentPos = (glm::vec3)e.Victim["Transform"]["Position"];
auto nextPos = glm::vec3(currentPos.x + 2.0f, currentPos.y, currentPos.z);
e.Inflictor["Transform"]["Position"] = nextPos;
//SPAWN
//load the explosioneffect XML
auto deathEffect = ResourceManager::Load<EntityFile>("Schema/Entities/PlayerDeathExplosionWithCamera.xml");
EntityFileParser parser2(deathEffect);
EntityID deathEffectID = parser2.MergeEntities(m_World);
EntityWrapper deathEffectEW = EntityWrapper(m_World, deathEffectID);
LOG_INFO("<- effect camera");
//components that we need from player
auto playerCamera = e.Victim.FirstChildByName("Camera");
auto playerModel = e.Victim.FirstChildByName("PlayerModel");
auto playerEntityModel = playerModel["Model"];
auto playerEntityAnimation = playerModel["Animation"];
LOG_INFO("-> effect camera");
//copy the data from player to explisioneffectmodel
playerEntityModel.Copy(deathEffectEW["Model"]);
playerEntityAnimation.Copy(deathEffectEW["Animation"]);
//freeze the animation
deathEffectEW["Animation"]["Speed1"] = 0.0;
deathEffectEW["Animation"]["Speed2"] = 0.0;
deathEffectEW["Animation"]["Speed3"] = 0.0;
//copy the models position,orientation
deathEffectEW["Transform"]["Position"] = (glm::vec3)e.Inflictor["Transform"]["Position"];
deathEffectEW["Transform"]["Orientation"] = (glm::vec3)e.Victim["Transform"]["Orientation"];
//TEST END
LOG_INFO("<- damageindicator");
if (m_CurrentCamera == EntityID_Invalid) {
+1 -1
View File
@@ -134,7 +134,7 @@ bool PlayerSpawnSystem::OnPlayerSpawned(Events::PlayerSpawned& e)
playerName["Text"]["Content"] = e.PlayerName;
}
if (!IsClient) {
if (m_NetworkEnabled && !IsClient) {
return false;
}