DebugDrawSphereComponent.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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/Component/Component.h>
  10. #include <AzCore/Script/ScriptTimePoint.h>
  11. #include <DebugDraw/DebugDrawBus.h>
  12. namespace DebugDraw
  13. {
  14. class DebugDrawSphereElement
  15. {
  16. public:
  17. AZ_CLASS_ALLOCATOR(DebugDrawSphereElement, AZ::SystemAllocator);
  18. AZ_TYPE_INFO(DebugDrawSphereElement, "{CB6F2781-DC26-4A10-8C5F-E07032574087}");
  19. static void Reflect(AZ::ReflectContext* context);
  20. float m_duration;
  21. AZ::ScriptTimePoint m_activateTime;
  22. AZ::Color m_color;
  23. AZ::EntityId m_targetEntityId;
  24. AZ::Vector3 m_worldLocation;
  25. float m_radius;
  26. AZ::ComponentId m_owningEditorComponent;
  27. DebugDrawSphereElement()
  28. : m_duration(0.f)
  29. , m_radius(1.0f)
  30. , m_color(1.0f, 1.0f, 1.0f, 1.0f) // AZ::Color::White
  31. , m_worldLocation(AZ::Vector3::CreateZero())
  32. {
  33. }
  34. };
  35. class DebugDrawSphereComponent
  36. : public AZ::Component
  37. {
  38. friend class DebugDrawSystemComponent;
  39. public:
  40. AZ_COMPONENT(DebugDrawSphereComponent, "{823F6C96-627E-4C98-A3B9-0168B5CB3706}");
  41. static void Reflect(AZ::ReflectContext* context);
  42. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  43. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  44. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  45. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
  46. DebugDrawSphereComponent() = default;
  47. explicit DebugDrawSphereComponent(const DebugDrawSphereElement& element);
  48. ~DebugDrawSphereComponent() override = default;
  49. ////////////////////////////////////////////////////////////////////////
  50. // AZ::Component interface implementation
  51. void Init() override;
  52. void Activate() override;
  53. void Deactivate() override;
  54. ////////////////////////////////////////////////////////////////////////
  55. protected:
  56. DebugDrawSphereElement m_element;
  57. };
  58. }