Forráskód Böngészése

Moved sprint toggle inside the allow player actions block

Signed-off-by: kberg-amzn <[email protected]>
kberg-amzn 2 éve
szülő
commit
3d69c5cda0

+ 7 - 6
Gem/Code/Source/Components/NetworkPlayerMovementComponent.cpp

@@ -137,12 +137,6 @@ namespace MultiplayerSample
         // Inputs for your own component always exist
         NetworkPlayerMovementComponentNetworkInput* playerInput = input.FindComponentInput<NetworkPlayerMovementComponentNetworkInput>();
 
-        if (m_toggleSprint)
-        {
-            m_sprinting = !m_sprinting;
-            m_toggleSprint = false;
-        }
-
         // Check current game-play state
         INetworkMatch* networkMatchComponent = AZ::Interface<INetworkMatch>::Get();
         if (networkMatchComponent && (networkMatchComponent->PlayerActionsAllowed() != AllowedPlayerActions::None))
@@ -159,6 +153,13 @@ namespace MultiplayerSample
 
         if (networkMatchComponent && (networkMatchComponent->PlayerActionsAllowed() == AllowedPlayerActions::All))
         {
+            // Check if the user requested to toggle sprint-state
+            if (m_toggleSprint)
+            {
+                m_sprinting = !m_sprinting;
+                m_toggleSprint = false;
+            }
+
             // Movement axis
             // Since we're on a keyboard, this adds a touch of an acceleration curve to the keyboard inputs
             // This is so that tapping the keyboard moves the virtual stick less than just holding it down