BVB Source Codes

CRYENGINE Show VehicleSeatAnimActions.cpp Source code

Return Download CRYENGINE: download VehicleSeatAnimActions.cpp Source code - Download CRYENGINE Source code - Type:.cpp
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /*************************************************************************
  4.    -------------------------------------------------------------------------
  5.    $Id$
  6.    $DateTime$
  7.    Description: Implements vehicle seat specific Mannequin actions
  8.  
  9.    -------------------------------------------------------------------------
  10.    History:
  11.    - 06:02:2012: Created by Tom Berry
  12.  
  13. *************************************************************************/
  14. #include "StdAfx.h"
  15.  
  16. #include "../Vehicle.h"
  17. #include "../VehicleSeat.h"
  18.  
  19. #include "VehicleSeatAnimActions.h"
  20.  
  21. void CVehicleSeatAnimActionEnter::Enter()
  22. {
  23.         BaseAction::Enter();
  24.  
  25.         bool isThirdPerson = !m_pSeat->ShouldEnterInFirstPerson();
  26.  
  27.         for (size_t i = 0; i < m_pSeat->GetViewCount(); ++i)
  28.         {
  29.                 IVehicleView* pView = m_pSeat->GetView(i + 1);
  30.                 if (pView && pView->IsThirdPerson() == isThirdPerson)
  31.                 {
  32.                         m_pSeat->SetView(i + 1);
  33.                         break;
  34.                 }
  35.         }
  36.  
  37.         IActor* pActor = m_pSeat->GetPassengerActor();
  38.         CRY_ASSERT(gEnv->bMultiplayer || pActor);
  39.  
  40.         IAnimatedCharacter* pAnimChar = pActor ? pActor->GetAnimatedCharacter() : nullptr;
  41.         if (pAnimChar)
  42.         {
  43.                 pAnimChar->SetMovementControlMethods(eMCM_Animation, eMCM_Animation);
  44.                 pAnimChar->RequestPhysicalColliderMode(eColliderMode_Disabled, eColliderModeLayer_Game, "CVehicleSeatAnimActionEnter::Enter");
  45.         }
  46. }
  47.  
  48. void CVehicleSeatAnimActionExit::Enter()
  49. {
  50.         BaseAction::Enter();
  51.  
  52.         bool isThirdPerson = !m_pSeat->ShouldExitInFirstPerson();
  53.  
  54.         for (size_t i = 0; i < m_pSeat->GetViewCount(); ++i)
  55.         {
  56.                 IVehicleView* pView = m_pSeat->GetView(i + 1);
  57.                 if (pView && pView->IsThirdPerson() == isThirdPerson)
  58.                 {
  59.                         m_pSeat->SetView(i + 1);
  60.                         break;
  61.                 }
  62.         }
  63.  
  64.         IActor* pActor = m_pSeat->GetPassengerActor();
  65.         CRY_ASSERT(gEnv->bMultiplayer || pActor);
  66.  
  67.         IAnimatedCharacter* pAnimChar = pActor ? pActor->GetAnimatedCharacter() : nullptr;
  68.         if (pAnimChar)
  69.         {
  70.                 pAnimChar->SetMovementControlMethods(eMCM_Animation, eMCM_Animation);
  71.                 pAnimChar->RequestPhysicalColliderMode(eColliderMode_Disabled, eColliderModeLayer_Game, "CVehicleSeatAnimActionExit::Enter");
  72.         }
  73. }
  74.  
  75. void CVehicleSeatAnimActionExit::Exit()
  76. {
  77.         BaseAction::Exit();
  78.  
  79.         // Leave the heli mid-air and this will trigger.
  80.         IActor* pActor = m_pSeat->GetPassengerActor();
  81.         CRY_ASSERT(gEnv->bMultiplayer || pActor);
  82.  
  83.         m_pSeat->StandUp();
  84. }
  85.  
downloadVehicleSeatAnimActions.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