Browse Source

Failed apples are not disappeared

Signed-off-by: Michał Pełka <[email protected]>
Michał Pełka 2 years ago
parent
commit
67deecff7d

+ 0 - 1
Project/Gem/Source/ApplePicker/ApplePickerComponent.cpp

@@ -279,7 +279,6 @@ namespace AppleKraken
         AZ_TracePrintf(
             "ApplePicker", "%s. Picking failed due to: %s\n", Internal::CurrentTaskString(m_currentAppleTasks).c_str(), reason.c_str());
         m_currentAppleTasks.pop();
-        PickNextApple();
     }
 
     void ApplePickerComponent::PickNextApple()

+ 2 - 7
Project/Gem/Source/ApplePicker/KrakenEffectorComponent.cpp

@@ -82,17 +82,13 @@ namespace AppleKraken
                 if (m_currentTask.m_appleEntityId == collideToEntityId)
                 {
                     AZ_Printf("m_onTriggerHandleBeginHandler", "=================m_onTriggerHandle to Apple!====================");
+                    ApplePickingNotificationBus::Broadcast(&ApplePickingNotifications::ApplePicked);
                     if (m_effectorState == EffectorState::PICKING)
                     {
                         // start picking the apple
                         BeginTransitionIfAcceptable(EffectorState::RETRIEVING);
                     }
                 }
-                AZ_Printf(
-                    "m_onTriggerHandleBeginHandler",
-                    "m_onTriggerHandleBeginHandler %s : %s \n",
-                    m_currentTask.m_appleEntityId.ToString().c_str(),
-                    collideToEntityId.ToString().c_str());
             });
     }
 
@@ -286,8 +282,6 @@ namespace AppleKraken
             return;
         }
         ManipulatorRequestBus::Event(m_manipulatorEntity, &ManipulatorRequest::Retrieve);
-        // TODO - also handle picking failed
-        ApplePickingNotificationBus::Broadcast(&ApplePickingNotifications::ApplePicked);
     }
 
     void KrakenEffectorComponent::OnAppleRetrieved()
@@ -301,6 +295,7 @@ namespace AppleKraken
         if (m_effectorState == EffectorState::PICKING && m_currentStateTransitionTime > 5)
         {
             AZ_Printf("m_onTriggerHandleBeginHandler", "---------------Failed to retrieve apple--------------------\n");
+            ApplePickingNotificationBus::Broadcast(&ApplePickingNotifications::PickingFailed, "Timeout");
             BeginTransitionIfAcceptable(EffectorState::RETRIEVING);
         }