BVB Source Codes

CRYENGINE Show MovementBlock_UseExactPositioningBase.h Source code

Return Download CRYENGINE: download MovementBlock_UseExactPositioningBase.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #pragma once
  4.  
  5. #ifndef MovementBlock_UseExactPositioningBase_h
  6.         #define MovementBlock_UseExactPositioningBase_h
  7.  
  8.         #include "MovementPlan.h"
  9.         #include <CryAISystem/MovementStyle.h>
  10.         #include "MovementHelpers.h"
  11.  
  12. namespace Movement
  13. {
  14. namespace MovementBlocks
  15. {
  16. // This block has two responsibilities but the logic was so closely
  17. // mapped that I decided to combine them into one.
  18. //
  19. // The two parts are 'Prepare' and 'Traverse'.
  20. //
  21. // If the exact positioning fails to position the character it calls
  22. // HandleExactPositioningError in which the derived class can
  23. // teleport to an appropriate target
  24.  
  25. class UseExactPositioningBase : public Movement::Block
  26. {
  27. public:
  28.         UseExactPositioningBase(const CNavPath& path, const MovementStyle& style);
  29.         virtual void   Begin(IMovementActor& actor) override;
  30.         virtual void   End(IMovementActor& actor) override;
  31.         virtual Status Update(const MovementUpdateContext& context) override;
  32.  
  33. protected:
  34.         enum TryRequestingExactPositioningResult
  35.         {
  36.                 RequestSucceeded,
  37.                 RequestDelayed_ContinuePathFollowing,
  38.                 RequestDelayed_SkipPathFollowing,
  39.                 RequestFailed_FinishImmediately,
  40.                 RequestFailed_CancelImmediately,
  41.         };
  42.  
  43.         // Called while preparing & when actortarget phase is None.
  44.         // The derived class is supposed to request an actor target in here.
  45.         virtual TryRequestingExactPositioningResult TryRequestingExactPositioning(const MovementUpdateContext& context) = 0;
  46.  
  47.         // Exact positioning failed to position the character. Teleport to an appropriate target.
  48.         virtual void HandleExactPositioningError(const MovementUpdateContext& context) = 0;
  49.  
  50.         virtual void OnTraverseStarted(const MovementUpdateContext& context) {}
  51.  
  52. private:
  53.         Status UpdatePrepare(const MovementUpdateContext& context);
  54.         Status UpdateTraverse(const MovementUpdateContext& context);
  55.  
  56. protected:
  57.         enum State
  58.         {
  59.                 Prepare,
  60.                 Traverse,
  61.         };
  62.  
  63.         MovementStyle m_style;
  64.         State         m_state;
  65.  
  66. private:
  67.         CNavPath                         m_path;
  68.         float                            m_accumulatedPathFollowerFailureTime;
  69.         Movement::Helpers::StuckDetector m_stuckDetector;
  70. };
  71. }
  72. }
  73.  
  74. #endif // MovementBlock_UseExactPositioningBase_h
  75.  
downloadMovementBlock_UseExactPositioningBase.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top