Merge remote-tracking branch 'origin/master' into Movement
# Conflicts: # include/Game/Systems/Weapon/DefenderWeaponBehaviour.h # resources/Schema/Components.xsd # resources/Schema/Entities/CP_Rocky2.xml # resources/Schema/Entities/MuzzleFlashBlue.xml # resources/Schema/Entities/MuzzleFlashFire.xml # resources/Schema/Entities/MuzzleFlashRed.xml # resources/Schema/Types/Entity.xsd # resources/Shaders/Sprite.frag.glsl # src/Game/Systems/AbilityCooldownHUDSystem.cpp # src/Game/Systems/BoostIconsHUDSystem.cpp # src/Game/Systems/PlayerMovementSystem.cpp # src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp # src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp # src/Game/Systems/Weapon/SidearmWeaponBehaviour.cpp
This commit is contained in:
@@ -73,7 +73,8 @@ void AnimationSystem::UpdateAnimations(double dt)
|
||||
|
||||
Model* model;
|
||||
try {
|
||||
model = ResourceManager::Load<::Model, true>(modelEntity["Model"]["Resource"]);
|
||||
Field<std::string> res = modelEntity["Model"]["Resource"];
|
||||
model = ResourceManager::Load<::Model, true>(res);
|
||||
} catch (const std::exception&) {
|
||||
continue;
|
||||
}
|
||||
@@ -89,23 +90,23 @@ void AnimationSystem::UpdateAnimations(double dt)
|
||||
continue;
|
||||
}
|
||||
|
||||
double animationSpeed = (double)animationC["Speed"];
|
||||
double animationSpeed = (const double&)animationC["Speed"];
|
||||
|
||||
if((bool)animationC["Reverse"]) {
|
||||
if((const bool&)animationC["Reverse"]) {
|
||||
animationSpeed *= -1;
|
||||
}
|
||||
|
||||
|
||||
if ((bool)animationC["Play"]) {
|
||||
if ((const bool&)animationC["Play"]) {
|
||||
|
||||
double nextTime = (double)animationC["Time"] + animationSpeed * dt;
|
||||
if (!(bool)animationC["Loop"]) {
|
||||
double nextTime = (Field<double>)animationC["Time"] + animationSpeed * dt;
|
||||
if (!(Field<bool>)animationC["Loop"]) {
|
||||
if (nextTime > animation->Duration) {
|
||||
nextTime = animation->Duration;
|
||||
(bool&)animationC["Play"] = false;
|
||||
(Field<bool>)animationC["Play"] = false;
|
||||
} else if (nextTime < 0) {
|
||||
nextTime = 0;
|
||||
(bool&)animationC["Play"] = false;
|
||||
(Field<bool>)animationC["Play"] = false;
|
||||
}
|
||||
} else {
|
||||
if (nextTime > animation->Duration) {
|
||||
@@ -119,7 +120,7 @@ void AnimationSystem::UpdateAnimations(double dt)
|
||||
}
|
||||
}
|
||||
}
|
||||
(double&)animationC["Time"] = nextTime;
|
||||
(Field<double>)animationC["Time"] = nextTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -219,15 +220,15 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
|
||||
if (entity.Valid()) {
|
||||
if (entity.HasComponent("Animation")) {
|
||||
const Skeleton::Animation* animation = skeleton->GetAnimation(entity["Animation"]["AnimationName"]);
|
||||
(bool&)entity["Animation"]["Reverse"] = e.Reverse;
|
||||
(Field<bool>)entity["Animation"]["Reverse"] = e.Reverse;
|
||||
|
||||
if (e.Restart) {
|
||||
if (animation != nullptr) {
|
||||
if (e.Restart) {
|
||||
if (e.Reverse) {
|
||||
(double&)entity["Animation"]["Time"] = animation->Duration;
|
||||
(Field<double>)entity["Animation"]["Time"] = animation->Duration;
|
||||
} else {
|
||||
(double&)entity["Animation"]["Time"] = 0.0;
|
||||
(Field<double>)entity["Animation"]["Time"] = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -266,15 +267,15 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
|
||||
if (entity.Valid()) {
|
||||
if (entity.HasComponent("Animation")) {
|
||||
const Skeleton::Animation* animation = skeleton->GetAnimation(entity["Animation"]["AnimationName"]);
|
||||
(bool&)entity["Animation"]["Reverse"] = e.Reverse;
|
||||
entity["Animation"]["Reverse"] = e.Reverse;
|
||||
|
||||
if (e.Restart) {
|
||||
if (animation != nullptr) {
|
||||
if (e.Restart) {
|
||||
if (e.Reverse) {
|
||||
(double&)entity["Animation"]["Time"] = animation->Duration;
|
||||
entity["Animation"]["Time"] = animation->Duration;
|
||||
} else {
|
||||
(double&)entity["Animation"]["Time"] = 0.0;
|
||||
entity["Animation"]["Time"] = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,7 +290,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
|
||||
|
||||
bool AnimationSystem::OnEntityDeleted(Events::EntityDeleted& e)
|
||||
{
|
||||
EntityWrapper entity = EntityWrapper(m_World, e.DeletedEntity);
|
||||
EntityWrapper entity = e.DeletedEntity;
|
||||
|
||||
if (entity.HasComponent("Model")) {
|
||||
Model* model;
|
||||
|
||||
Reference in New Issue
Block a user