BVB Source Codes

CRYENGINE Show MovementActor.cpp Source code

Return Download CRYENGINE: download MovementActor.cpp Source code - Download CRYENGINE Source code - Type:.cpp
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #include "StdAfx.h"
  4. #include "MovementActor.h"
  5. #include "../PipeUser.h"
  6. #include "MovementPlanner.h"
  7.  
  8. void MovementActor::SetLowCoverStance()
  9. {
  10.         GetAIActor()->GetState().bodystate = STANCE_LOW_COVER;
  11. }
  12.  
  13. CAIActor* MovementActor::GetAIActor()
  14. {
  15.         CAIActor* aiActor = NULL;
  16.  
  17.         if (IEntity* entity = gEnv->pEntitySystem->GetEntity(entityID))
  18.                 if (IAIObject* ai = entity->GetAI())
  19.                         aiActor = ai->CastToCAIActor();
  20.  
  21.         return aiActor;
  22. }
  23.  
  24. const char* MovementActor::GetName() const
  25. {
  26.         const IEntity* pEntity = gEnv->pEntitySystem->GetEntity(entityID);
  27.         return pEntity ? pEntity->GetName() : "(none)";
  28. }
  29.  
  30. void MovementActor::RequestPathTo(const Vec3& destination, float lengthToTrimFromThePathEnd, const MNMDangersFlags dangersFlags /* = eMNMDangers_None */, const bool considerActorsAsPathObstacles)
  31. {
  32.         const bool cutPathAtSmartObject = false;
  33.  
  34.         const IEntity* pEntity = gEnv->pEntitySystem->GetEntity(entityID);
  35.         if (!pEntity)
  36.                 return;
  37.  
  38.         if (callbacks.queuePathRequestFunction)
  39.         {
  40.                 MNMPathRequest request(pEntity->GetPos(), destination, Vec3(0, 1, 0), -1, 0.0f, lengthToTrimFromThePathEnd, true, NULL, this->pAdapter->GetNavigationAgentTypeID(), dangersFlags);
  41.                 callbacks.queuePathRequestFunction(request);
  42.         }
  43. }
  44.  
  45. Movement::PathfinderState MovementActor::GetPathfinderState() const
  46. {
  47.         if (callbacks.checkOnPathfinderStateFunction)
  48.         {
  49.                 return callbacks.checkOnPathfinderStateFunction();
  50.         }
  51.  
  52.         return Movement::CouldNotFindPath;
  53. }
  54.  
  55. void MovementActor::Log(const char* message)
  56. {
  57. #ifdef AI_COMPILE_WITH_PERSONAL_LOG
  58.         if (GetAIActor())
  59.         {
  60.                 GetAIActor()->GetPersonalLog().AddMessage(entityID, message);
  61.         }
  62. #endif
  63. }
  64.  
  65. IMovementActorAdapter& MovementActor::GetAdapter() const
  66. {
  67.         assert(pAdapter);
  68.         return *pAdapter;
  69. }
  70.  
downloadMovementActor.cpp 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