${Name}SystemComponent.cpp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. #include <AzCore/Serialization/SerializeContext.h>
  9. #include <AzCore/Serialization/EditContext.h>
  10. #include <AzCore/Serialization/EditContextConstants.inl>
  11. #include "${Name}SystemComponent.h"
  12. namespace ${SanitizedCppName}
  13. {
  14. void ${SanitizedCppName}SystemComponent::Reflect(AZ::ReflectContext* context)
  15. {
  16. if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
  17. {
  18. serialize->Class<${SanitizedCppName}SystemComponent, AZ::Component>()
  19. ->Version(0)
  20. ;
  21. if (AZ::EditContext* ec = serialize->GetEditContext())
  22. {
  23. ec->Class<${SanitizedCppName}SystemComponent>("${SanitizedCppName}", "[Description of functionality provided by this System Component]")
  24. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  25. ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System"))
  26. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  27. ;
  28. }
  29. }
  30. }
  31. void ${SanitizedCppName}SystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  32. {
  33. provided.push_back(AZ_CRC("${SanitizedCppName}Service"));
  34. }
  35. void ${SanitizedCppName}SystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  36. {
  37. incompatible.push_back(AZ_CRC("${SanitizedCppName}Service"));
  38. }
  39. void ${SanitizedCppName}SystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
  40. {
  41. }
  42. void ${SanitizedCppName}SystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
  43. {
  44. }
  45. ${SanitizedCppName}SystemComponent::${SanitizedCppName}SystemComponent()
  46. {
  47. if (${SanitizedCppName}Interface::Get() == nullptr)
  48. {
  49. ${SanitizedCppName}Interface::Register(this);
  50. }
  51. }
  52. ${SanitizedCppName}SystemComponent::~${SanitizedCppName}SystemComponent()
  53. {
  54. if (${SanitizedCppName}Interface::Get() == this)
  55. {
  56. ${SanitizedCppName}Interface::Unregister(this);
  57. }
  58. }
  59. void ${SanitizedCppName}SystemComponent::Init()
  60. {
  61. }
  62. void ${SanitizedCppName}SystemComponent::Activate()
  63. {
  64. ${SanitizedCppName}RequestBus::Handler::BusConnect();
  65. }
  66. void ${SanitizedCppName}SystemComponent::Deactivate()
  67. {
  68. ${SanitizedCppName}RequestBus::Handler::BusDisconnect();
  69. }
  70. }