${Name}SystemComponent.cpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // {BEGIN_LICENSE}
  2. /*
  3. * Copyright (c) Contributors to the Open 3D Engine Project.
  4. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. *
  6. * SPDX-License-Identifier: Apache-2.0 OR MIT
  7. *
  8. */
  9. // {END_LICENSE}
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. #include "${Name}SystemComponent.h"
  12. #include <${Name}/${Name}TypeIds.h>
  13. namespace ${SanitizedCppName}
  14. {
  15. AZ_COMPONENT_IMPL(${SanitizedCppName}SystemComponent, "${SanitizedCppName}SystemComponent",
  16. ${SanitizedCppName}SystemComponentTypeId);
  17. void ${SanitizedCppName}SystemComponent::Reflect(AZ::ReflectContext* context)
  18. {
  19. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  20. {
  21. serializeContext->Class<${SanitizedCppName}SystemComponent, AZ::Component>()
  22. ->Version(0)
  23. ;
  24. }
  25. }
  26. void ${SanitizedCppName}SystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  27. {
  28. provided.push_back(AZ_CRC_CE("${SanitizedCppName}Service"));
  29. }
  30. void ${SanitizedCppName}SystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  31. {
  32. incompatible.push_back(AZ_CRC_CE("${SanitizedCppName}Service"));
  33. }
  34. void ${SanitizedCppName}SystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
  35. {
  36. }
  37. void ${SanitizedCppName}SystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
  38. {
  39. }
  40. ${SanitizedCppName}SystemComponent::${SanitizedCppName}SystemComponent()
  41. {
  42. if (${SanitizedCppName}Interface::Get() == nullptr)
  43. {
  44. ${SanitizedCppName}Interface::Register(this);
  45. }
  46. }
  47. ${SanitizedCppName}SystemComponent::~${SanitizedCppName}SystemComponent()
  48. {
  49. if (${SanitizedCppName}Interface::Get() == this)
  50. {
  51. ${SanitizedCppName}Interface::Unregister(this);
  52. }
  53. }
  54. void ${SanitizedCppName}SystemComponent::Init()
  55. {
  56. }
  57. void ${SanitizedCppName}SystemComponent::Activate()
  58. {
  59. ${SanitizedCppName}RequestBus::Handler::BusConnect();
  60. }
  61. void ${SanitizedCppName}SystemComponent::Deactivate()
  62. {
  63. ${SanitizedCppName}RequestBus::Handler::BusDisconnect();
  64. }
  65. }