WIP respawning.

This commit is contained in:
William Moberg
2016-02-11 16:08:19 +01:00
parent c3cc5ae70b
commit 8eea0c8395
7 changed files with 101 additions and 128 deletions
+12 -3
View File
@@ -34,14 +34,23 @@ void PlayerDeathSystem::createDeathEffect(EntityWrapper player)
//components that we need from player
auto playerCamera = player.FirstChildByName("Camera");
auto playerEntityModel = player.FirstChildByName("PlayerModel")["Model"];
auto playerEntityAnimation = player.FirstChildByName("PlayerModel")["Animation"];
auto playerModel = player.FirstChildByName("PlayerModel");
if (!playerCamera.Valid() || !playerModel.Valid()) {
return;
}
if (!playerModel.HasComponent("Model") || !playerModel.HasComponent("Animation")) {
return;
}
auto playerEntityModel = playerModel["Model"];
auto playerEntityAnimation = playerModel["Animation"];
//copy the data from player to explisioneffectmodel
playerEntityModel.Copy(deathEffectEW["Model"]);
playerEntityAnimation.Copy(deathEffectEW["Animation"]);
//freeze the animation
deathEffectEW["Animation"]["Speed"] = 0.0;
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)player["Transform"]["Position"];