added safety ifs and renamed dasheffect to sprinteffect
This commit is contained in:
@@ -38,22 +38,28 @@ void PlayerMovementSystem::Update(double dt)
|
|||||||
// Spawn one afterimage for each player that sprints.
|
// Spawn one afterimage for each player that sprints.
|
||||||
EntityWrapper player(m_World, cSprint.EntityID);
|
EntityWrapper player(m_World, cSprint.EntityID);
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/SprintEffect.xml");
|
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/SprintEffect.xml");
|
||||||
EntityWrapper dashEffect = entityFile->MergeInto(m_World);
|
EntityWrapper sprintEffect = entityFile->MergeInto(m_World);
|
||||||
auto playerModel = player.FirstChildByName("PlayerModel");
|
auto playerModel = player.FirstChildByName("PlayerModel");
|
||||||
if (!playerModel.Valid()) {
|
if (!playerModel.Valid()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!playerModel.HasComponent("Model")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!playerModel.HasComponent("Animation")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
auto playerEntityModel = playerModel["Model"];
|
auto playerEntityModel = playerModel["Model"];
|
||||||
auto playerEntityAnimation = playerModel["Animation"];
|
auto playerEntityAnimation = playerModel["Animation"];
|
||||||
playerEntityModel.Copy(dashEffect["Model"]);
|
playerEntityModel.Copy(sprintEffect["Model"]);
|
||||||
playerEntityAnimation.Copy(dashEffect["Animation"]);
|
playerEntityAnimation.Copy(sprintEffect["Animation"]);
|
||||||
dashEffect["ExplosionEffect"]["EndColor"] = (glm::vec4)playerEntityModel["Color"];
|
sprintEffect["ExplosionEffect"]["EndColor"] = (glm::vec4)playerEntityModel["Color"];
|
||||||
((glm::vec4&)dashEffect["ExplosionEffect"]["EndColor"]).w = 0.f;
|
((glm::vec4&)sprintEffect["ExplosionEffect"]["EndColor"]).w = 0.f;
|
||||||
dashEffect["Animation"]["Speed1"] = 0.0;
|
sprintEffect["Animation"]["Speed1"] = 0.0;
|
||||||
dashEffect["Animation"]["Speed2"] = 0.0;
|
sprintEffect["Animation"]["Speed2"] = 0.0;
|
||||||
dashEffect["Animation"]["Speed3"] = 0.0;
|
sprintEffect["Animation"]["Speed3"] = 0.0;
|
||||||
dashEffect["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
|
sprintEffect["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
|
||||||
dashEffect["Transform"]["Orientation"] = (glm::vec3)player["Transform"]["Orientation"];
|
sprintEffect["Transform"]["Orientation"] = (glm::vec3)player["Transform"]["Orientation"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user