5
5
#include < limits>
6
6
#include < cmath>
7
7
#include < algorithm>
8
- AutoPickSystem::AutoPickSystem (std::shared_ptr<SceneManager> scenemnager):System(scenemnager)
8
+ AutoPickSystem::AutoPickSystem (std::shared_ptr<SceneManager> scenemnager) :System(scenemnager)
9
9
{
10
10
EventManager::GetInstance ().Subscribe (" OnAutoPickup" , CreateSubscriber (&AutoPickSystem::OnAutoPickup));
11
11
}
@@ -40,7 +40,7 @@ void AutoPickSystem::AddPickup(AutoPickComponent* autopick, GunComponent* pickup
40
40
}
41
41
}
42
42
43
- void AutoPickSystem::ReleasePickup (AutoPickComponent* autopick, GunComponent* pickuped)
43
+ void AutoPickSystem::ReleasePickup (AutoPickComponent* autopick, GunComponent* pickuped)
44
44
{
45
45
auto it = std::find (autopick->PickUps .begin (), autopick->PickUps .end (), pickuped->GetEntityID ());
46
46
if (it != autopick->PickUps .end ())
@@ -60,15 +60,22 @@ void AutoPickSystem::OnAutoPickup(std::any pcomp)
60
60
void AutoPickSystem::FixedUpdate (float deltaTime)
61
61
{
62
62
63
- COMPLOOP (AutoPickComponent, pickupcomp)
63
+ COMPLOOP (AutoPickComponent, pickupcomp)
64
64
{
65
65
if (pickupcomp.ParentPlayer
66
66
&& pickupcomp.IsAuto
67
67
&& !pickupcomp.ParentPlayer ->HasGun
68
68
&& !pickupcomp.ParentPlayer ->IsVPMode
69
- && pickupcomp.ParentPlayer ->HandEntity .lock ()->GetComponent <AnimationComponent>()->curAni == static_cast <int >(VisPred::Game::PlayerAni::ToIdle02_Sword)
69
+ && (pickupcomp.ParentPlayer ->HandEntity .lock ()->GetComponent <AnimationComponent>()->curAni == static_cast <int >(VisPred::Game::PlayerAni::ToIdle02_Sword)
70
+ || pickupcomp.ParentPlayer ->HandEntity .lock ()->GetComponent <AnimationComponent>()->curAni == static_cast <int >(VisPred::Game::PlayerAni::ToIdle01_Sword)
71
+ || pickupcomp.ParentPlayer ->HandEntity .lock ()->GetComponent <AnimationComponent>()->curAni == static_cast <int >(VisPred::Game::PlayerAni::ToAttack1_Sword)
72
+ || pickupcomp.ParentPlayer ->HandEntity .lock ()->GetComponent <AnimationComponent>()->curAni == static_cast <int >(VisPred::Game::PlayerAni::ToAttack2_Sword)
73
+ || pickupcomp.ParentPlayer ->HandEntity .lock ()->GetComponent <AnimationComponent>()->curAni == static_cast <int >(VisPred::Game::PlayerAni::ToAttack3_Sword) )
70
74
&& !pickupcomp.ParentPlayer ->HandEntity .lock ()->GetComponent <AnimationComponent>()->IsBlending )
71
75
{
76
+
77
+ pickupcomp.ParentPlayer ->IsAttacking = false ;
78
+
72
79
AutoPickUp (&pickupcomp);
73
80
}
74
81
}
@@ -148,7 +155,7 @@ void AutoPickSystem::RemoveInvalidEntities(AutoPickComponent* autopick)
148
155
{
149
156
it = autopick->PickUps .erase (it);
150
157
}
151
- else if (entity->HasComponent <GunComponent>()&& entity->GetComponent <GunComponent>()->IsEmpty )
158
+ else if (entity->HasComponent <GunComponent>() && entity->GetComponent <GunComponent>()->IsEmpty )
152
159
{
153
160
it = autopick->PickUps .erase (it);
154
161
}
@@ -161,7 +168,7 @@ void AutoPickSystem::RemoveInvalidEntities(AutoPickComponent* autopick)
161
168
bool AutoPickSystem::IsValidPickupEntity (uint32_t entityID)
162
169
{
163
170
auto entity = GetSceneManager ()->GetEntity (entityID);
164
- if (!entity || !m_PhysicsEngine->IsDynamic (entityID))
171
+ if (!entity || !m_PhysicsEngine->IsDynamic (entityID))
165
172
return false ;
166
173
167
174
auto guncomp = entity->GetComponent <GunComponent>();
0 commit comments