${Name}SystemComponent.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 "${Name}SystemComponent.h"
  11. #include <${Name}/${Name}TypeIds.h>
  12. #include <AzCore/Serialization/SerializeContext.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. AZ::TickBus::Handler::BusConnect();
  61. }
  62. void ${SanitizedCppName}SystemComponent::Deactivate()
  63. {
  64. AZ::TickBus::Handler::BusDisconnect();
  65. ${SanitizedCppName}RequestBus::Handler::BusDisconnect();
  66. }
  67. void ${SanitizedCppName}SystemComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
  68. {
  69. }
  70. } // namespace ${SanitizedCppName}