From 146df21067ca265c40af96ec5b1941ce1ef8d0af Mon Sep 17 00:00:00 2001 From: Bilal Kahraman Date: Wed, 18 Dec 2024 20:09:43 +0300 Subject: [PATCH] Update animation refs --- src/Core/src/game.cpp | 19 +++++++++---------- src/State/include/State/enemy_state.h | 4 ++-- src/State/include/State/weapon_state.h | 4 ++-- src/State/src/enemy_state.cpp | 8 ++++---- src/State/src/weapon_state.cpp | 9 ++++----- 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/Core/src/game.cpp b/src/Core/src/game.cpp index 0fc5ed7..f8ca9ae 100644 --- a/src/Core/src/game.cpp +++ b/src/Core/src/game.cpp @@ -1,5 +1,4 @@ -#include "Core/game.h" -#include "Animation/time_based_single_animation.h" +#include "Animation/looped_animation.h" #include "Camera/single_raycaster.h" #include "Characters/enemy.h" #include "GameObjects/dynamic_object.h" @@ -228,30 +227,30 @@ void Game::PrepareEnemies() { } void Game::PrepareDynamicObjects() { - const auto animation_green_light = TBSAnimation( + const auto animation_green_light = LoopedAnimation( TextureManager::GetInstance().GetTextureCollection("green_light"), 0.1); - const auto animation_red_light = TBSAnimation( + const auto animation_red_light = LoopedAnimation( TextureManager::GetInstance().GetTextureCollection("red_light"), 0.1); scene_->AddObject(std::make_shared( vector2d(12.1, 8.15), - std::make_shared(animation_red_light), 0.2, 0.9)); + std::make_unique(animation_red_light), 0.2, 0.9)); scene_->AddObject(std::make_shared( vector2d(10.9, 8.15), - std::make_shared(animation_red_light), 0.2, 0.9)); + std::make_unique(animation_red_light), 0.2, 0.9)); scene_->AddObject(std::make_shared( vector2d(9.9, 10.9), - std::make_shared(animation_green_light), 0.2, 0.9)); + std::make_unique(animation_green_light), 0.2, 0.9)); scene_->AddObject(std::make_shared( vector2d(9.9, 13.10), - std::make_shared(animation_green_light), 0.2, 0.9)); + std::make_unique(animation_green_light), 0.2, 0.9)); scene_->AddObject(std::make_shared( vector2d(12.1, 13.1), - std::make_shared(animation_green_light), 0.2, 0.9)); + std::make_unique(animation_green_light), 0.2, 0.9)); scene_->AddObject(std::make_shared( vector2d(12.1, 10.9), - std::make_shared(animation_green_light), 0.2, 0.9)); + std::make_unique(animation_green_light), 0.2, 0.9)); } void Game::PrepareStaticObjects() { diff --git a/src/State/include/State/enemy_state.h b/src/State/include/State/enemy_state.h index 0f783b1..3f936bc 100644 --- a/src/State/include/State/enemy_state.h +++ b/src/State/include/State/enemy_state.h @@ -12,7 +12,7 @@ #ifndef STATE_INCLUDE_STATE_ENEMY_STATE_H_ #define STATE_INCLUDE_STATE_ENEMY_STATE_H_ -#include "Animation/time_based_single_animation.h" +#include "Animation/looped_animation.h" #include "State/state.h" #include #include @@ -37,7 +37,7 @@ class EnemyState : public State int GetCurrentFrame() const override; protected: - std::unique_ptr animation_; + std::unique_ptr animation_; }; typedef std::shared_ptr EnemyStatePtr; diff --git a/src/State/include/State/weapon_state.h b/src/State/include/State/weapon_state.h index 10b6cc3..002d0e2 100644 --- a/src/State/include/State/weapon_state.h +++ b/src/State/include/State/weapon_state.h @@ -12,7 +12,7 @@ #ifndef STATE_INCLUDE_STATE_WEAPON_STATE_H_ #define STATE_INCLUDE_STATE_WEAPON_STATE_H_ -#include "Animation/time_based_single_animation.h" +#include "Animation/looped_animation.h" #include "State/state.h" #include @@ -36,7 +36,7 @@ class WeaponState : public State int GetCurrentFrame() const override; protected: - std::unique_ptr animation_; + std::unique_ptr animation_; }; typedef std::shared_ptr WeaponStatePtr; diff --git a/src/State/src/enemy_state.cpp b/src/State/src/enemy_state.cpp index f32543b..7af567f 100644 --- a/src/State/src/enemy_state.cpp +++ b/src/State/src/enemy_state.cpp @@ -34,7 +34,7 @@ void IdleState::OnContextSet() { const auto config = context_->GetStateConfig(); animation_speed_ = config.animation_time.idle_animation_speed; range_ = config.follow_range_max; - animation_ = std::make_unique( + animation_ = std::make_unique( TextureManager::GetInstance().GetTextureCollection( context_->GetBotName() + "_idle"), animation_speed_); @@ -98,7 +98,7 @@ void WalkState::Update(const double& delta_time) { void WalkState::OnContextSet() { attack_rate_ = context_->GetWeapon()->GetAttackRate(); attack_range_ = context_->GetWeapon()->GetAttackRange(); - animation_ = std::make_unique( + animation_ = std::make_unique( context_->GetBotName() + "_walk", animation_speed_); } @@ -129,7 +129,7 @@ void AttackState::Update(const double& delta_time) { void AttackState::OnContextSet() { animation_speed_ = context_->GetWeapon()->GetAttackSpeed(); - animation_ = std::make_unique( + animation_ = std::make_unique( context_->GetBotName() + "_attack", animation_speed_); } @@ -156,7 +156,7 @@ void PainState::Update(const double& delta_time) { } void PainState::OnContextSet() { - animation_ = std::make_unique( + animation_ = std::make_unique( context_->GetBotName() + "_pain", animation_speed_); } diff --git a/src/State/src/weapon_state.cpp b/src/State/src/weapon_state.cpp index dc8f65e..1538ee0 100644 --- a/src/State/src/weapon_state.cpp +++ b/src/State/src/weapon_state.cpp @@ -1,5 +1,4 @@ -#include "State/weapon_state.h" -#include "Animation/time_based_single_animation.h" +#include "Animation/looped_animation.h" #include "ShootingManager/shooting_manager.h" #include "State/state.h" #include "Strike/weapon.h" @@ -43,7 +42,7 @@ WeaponStateType LoadedState::GetType() const { void LoadedState::OnContextSet() { fire_rate_ = context_->GetAttackSpeed(); - animation_ = std::make_unique( + animation_ = std::make_unique( context_->GetWeaponName() + "_loaded", fire_rate_); } @@ -80,7 +79,7 @@ WeaponStateType OutOfAmmoState::GetType() const { void OutOfAmmoState::OnContextSet() { fire_rate_ = context_->GetAttackSpeed(); - animation_ = std::make_unique( + animation_ = std::make_unique( context_->GetWeaponName() + "_outofammo", fire_rate_); } @@ -114,7 +113,7 @@ WeaponStateType ReloadingState::GetType() const { void ReloadingState::OnContextSet() { reload_speed_ = context_->GetReloadSpeed(); - animation_ = std::make_unique( + animation_ = std::make_unique( context_->GetWeaponName() + "_reload", reload_speed_); }