The fourth and last function checks out whether all pickups in the level are collected by comparing the int CollectedItems variable and the int TotalItems variable (counting in Game Mode Actor from a Begin Play Event). This last function is executing the following tasks:
• Stopping the player's ability to collect
• Labeling the mission as finished
• Unlocking exit gates, and
• Updating the UI text via Interface.
This is the C++ translation, calling several delegates instead of using the Interface. This method proved more efficient than the latter for updating UI after a couple of tests.
if (CollectedItems == TotalItems)
{
CanPickup = false;
MissionAccomplished = true;
Mission_Accomplished.Broadcast();
All_Pickups_Collected.Broadcast();
Interact_Finished.Broadcast();
}
You can find more information about this Interact method here: https://www.3dartviz.com/skills/skills-tech/programming-video-game-interaction-cpp.html#allPickupsCollected