SequenceAgent.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 <AzCore/RTTI/BehaviorContext.h>
  10. #include <AzCore/Component/ComponentBus.h>
  11. #include <AzCore/Component/EntityId.h>
  12. #include <Maestro/Bus/SequenceAgentComponentBus.h>
  13. #include <AzCore/Serialization/SerializeContext.h>
  14. namespace Maestro
  15. {
  16. class SequenceAgent
  17. {
  18. friend class AZ::SerializeContext;
  19. protected:
  20. virtual ~SequenceAgent() = default;
  21. // This pure virtual is required for the Editor and RunTime to find the componentTypeId - in the Editor
  22. // it accounts for the GenericComponentWrapper component
  23. virtual AZ::TypeId GetComponentTypeUuid(const AZ::Component& component) const = 0;
  24. // Get all of the components available on the current entity.
  25. virtual void GetEntityComponents(AZ::Entity::ComponentArrayType& entityComponents) const = 0;
  26. // this is called on Activate() - it traverses all components on the given entity and fills in m_addressToBehaviorVirtualPropertiesMap
  27. // with all virtual properties on EBuses it finds. Calling it clears out any previously mapped virtualProperties
  28. void CacheAllVirtualPropertiesFromBehaviorContext();
  29. AZ::Uuid GetVirtualPropertyTypeId(const Maestro::SequenceComponentRequests::AnimatablePropertyAddress& animatedAddress) const;
  30. void GetAnimatedPropertyValue(Maestro::SequenceComponentRequests::AnimatedValue& returnValue, AZ::EntityId entityId, const Maestro::SequenceComponentRequests::AnimatablePropertyAddress& animatableAddress);
  31. bool SetAnimatedPropertyValue(AZ::EntityId entityId, const Maestro::SequenceComponentRequests::AnimatablePropertyAddress& animatableAddress, const Maestro::SequenceComponentRequests::AnimatedValue& value);
  32. void GetAssetDuration(Maestro::SequenceComponentRequests::AnimatedValue& returnValue, AZ::ComponentId componentId, const AZ::Data::AssetId& assetId);
  33. AZStd::unordered_map<Maestro::SequenceComponentRequests::AnimatablePropertyAddress, AZ::BehaviorEBus::VirtualProperty*> m_addressToBehaviorVirtualPropertiesMap;
  34. AZStd::unordered_map<AZ::ComponentId, AZ::BehaviorEBusEventSender*> m_addressToGetAssetDurationMap;
  35. };
  36. } // namespace Maestro