BVB Source Codes

CRYENGINE Show CommunicationPlayer.h Source code

Return Download CRYENGINE: download CommunicationPlayer.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #ifndef __CommunicationPlayer_h__
  4. #define __CommunicationPlayer_h__
  5.  
  6. #pragma once
  7.  
  8. #include "Communication.h"
  9.  
  10. class CommunicationPlayer : public IAICommunicationHandler::IEventListener
  11. {
  12. public:
  13.         struct ICommunicationFinishedListener
  14.         {
  15.                 /// playID is the id of the communication to stop.
  16.                 /// StateFlags contains  whether the components of the communication are finished or not (animation, sound, etc).
  17.                 virtual void OnCommunicationFinished(const CommPlayID& playID, uint8 stateFlags) = 0;
  18.                 virtual ~ICommunicationFinishedListener(){}
  19.         };
  20.  
  21. public:
  22.         void         Clear();
  23.         void         Reset();
  24.  
  25.         bool         Play(const CommPlayID& playID, const SCommunicationRequest& request,
  26.                           const SCommunication& comm, uint32 variationIdx, ICommunicationFinishedListener* listener, void* param);
  27.         void         Stop(const CommPlayID& playID);
  28.         void         Update(float updateTime);
  29.  
  30.         bool         IsPlaying(const CommPlayID& playID, float* remainingTime = 0) const;
  31.  
  32.         virtual void OnCommunicationHandlerEvent(
  33.           IAICommunicationHandler::ECommunicationHandlerEvent type, CommPlayID playID, EntityId actorID);
  34.  
  35.         CommID GetCommunicationID(const CommPlayID& playID) const;
  36.  
  37. public:
  38.         struct PlayState
  39.         {
  40.                 enum EFinishedFlags
  41.                 {
  42.                         FinishedAnimation = 1 << 0,
  43.                         FinishedSound     = 1 << 1,
  44.                         FinishedVoice     = 1 << 2,
  45.                         FinishedTimeout   = 1 << 3,
  46.                         FinishedAll       = FinishedAnimation | FinishedSound | FinishedVoice | FinishedTimeout,
  47.                 };
  48.  
  49.                 PlayState(const SCommunicationRequest& request, const SCommunicationVariation& variation,
  50.                           ICommunicationFinishedListener* _listener = 0, void* _param = 0)
  51.                         : actorID(request.actorID)
  52.                         , commID(request.commID)
  53.                         , timeout(variation.timeout)
  54.                         , target(request.target)
  55.                         , targetID(request.targetID)
  56.                         , flags(variation.flags)
  57.                         , finishedFlags(0)
  58.                         , listener(_listener)
  59.                         , param(_param)
  60.                 {
  61.                 }
  62.                 ~PlayState(){}
  63.  
  64.                 void OnCommunicationEvent(
  65.                   IAICommunicationHandler::ECommunicationHandlerEvent type, EntityId actorID);
  66.  
  67.                 Vec3                            target;
  68.  
  69.                 string                          animationName;
  70.  
  71.                 ICommunicationFinishedListener* listener;
  72.                 void*                           param;
  73.  
  74.                 EntityId                        targetID;
  75.                 EntityId                        actorID;
  76.  
  77.                 SCommunicationSound             soundInfo;
  78.                 SCommunicationSound             voiceInfo;
  79.  
  80.                 CommID                          commID;
  81.  
  82.                 float                           timeout;
  83.                 uint32                          flags;
  84.  
  85.                 //Tracks whether this playstate has finished.
  86.                 uint8 finishedFlags;
  87.         };
  88.  
  89. private:
  90.  
  91.         void CleanUpPlayState(const CommPlayID& playID, PlayState& playState);
  92.  
  93.         bool UpdatePlaying(const CommPlayID& playId, PlayState& playing, float updateTime);
  94.         void BlockingSettings(IAIObject* aiObject, PlayState& playing, bool set);
  95.  
  96.         typedef std::map<CommPlayID, PlayState> PlayingCommunications;
  97.         PlayingCommunications m_playing;
  98. };
  99.  
  100. #endif
  101.  
downloadCommunicationPlayer.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