NetworkAiComponent.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0 OR MIT
  5. *
  6. */
  7. #pragma once
  8. #include <Source/AutoGen/NetworkAiComponent.AutoComponent.h>
  9. #include <AzCore/Math/Random.h>
  10. namespace ${SanitizedCppName}
  11. {
  12. class NetworkWeaponsComponentController;
  13. class NetworkPlayerMovementComponentController;
  14. // The NetworkAiComponent, when active, can execute behaviors and produce synthetic inputs to drive the
  15. // NetworkPlayerMovementComponentController and NetworkWeaponsComponentController.
  16. class NetworkAiComponentController
  17. : public NetworkAiComponentControllerBase
  18. {
  19. public:
  20. NetworkAiComponentController(NetworkAiComponent& parent);
  21. void OnActivate([[maybe_unused]] Multiplayer::EntityIsMigrating entityIsMigrating) override {};
  22. void OnDeactivate([[maybe_unused]] Multiplayer::EntityIsMigrating entityIsMigrating) override {};
  23. #if AZ_TRAIT_SERVER
  24. void TickMovement(NetworkPlayerMovementComponentController& movementController, float deltaTime);
  25. void TickWeapons(NetworkWeaponsComponentController& weaponsController, float deltaTime);
  26. #endif
  27. private:
  28. friend class NetworkStressTestComponentController;
  29. #if AZ_TRAIT_SERVER
  30. void ConfigureAi(
  31. float fireIntervalMinMs, float fireIntervalMaxMs, float actionIntervalMinMs, float actionIntervalMaxMs, uint64_t seed);
  32. // TODO: Technically this guy should also be authority to autonomous so we don't roll different values after a migration..
  33. AZ::SimpleLcgRandom m_lcg;
  34. #endif
  35. };
  36. }