FruitStorageBus.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include "../DemoStatistics/AppleEvent.h"
  10. #include <AzCore/Component/EntityId.h>
  11. #include <AzCore/EBus/EBus.h>
  12. #include <AzCore/EBus/Event.h>
  13. namespace AppleKraken
  14. {
  15. using ApplesGatheredByTag = AZStd::unordered_map<AZStd::string, uint32_t>;
  16. //! Interface handing fruits storage requests
  17. class FruitStorageRequests : public AZ::EBusTraits
  18. {
  19. public:
  20. static constexpr AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
  21. using BusIdType = AZ::EntityId;
  22. virtual ~FruitStorageRequests() = default;
  23. //! Gets counts of apples gathered with certain tags. When no tags are provided, returns number of all apples gathered.
  24. virtual ApplesGatheredByTag GetTotalGatheredAppleCount(const Tags& tags = {}) const = 0;
  25. //! Gets only apples currently in storage
  26. virtual uint32_t GetCurrentStorageAppleCount() const = 0;
  27. //! Adds one apple associated with certain tags to the gathered apples counters.
  28. virtual void AddApple(const Tags& tags = {}) = 0;
  29. };
  30. using FruitStorageRequestsBus = AZ::EBus<FruitStorageRequests>;
  31. } // namespace AppleKraken