ai_controller.h 591 B

123456789101112131415161718192021222324252627282930
  1. // Copyright (c) 2022-2023 the Dviglo project
  2. // Copyright (c) 2008-2023 the Urho3D project
  3. // License: MIT
  4. #pragma once
  5. #include <Urho3D/Urho3DAll.h>
  6. namespace Urho3D
  7. {
  8. class Ninja;
  9. void ResetAI();
  10. void MakeAIHarder();
  11. class AIController
  12. {
  13. private:
  14. // Use a weak handle instead of a normal handle to point to the current target
  15. // so that we don't mistakenly keep it alive.
  16. WeakPtr<Node> currentTarget;
  17. float newTargetTimer = 0;
  18. public:
  19. void Control(Ninja* ownNinja, Node* ownNode, float timeStep);
  20. void GetNewTarget(Node* ownNode);
  21. };
  22. } // namespace Urho3D