BVB Source Codes

CRYENGINE Show CommunicationChannel.cpp Source code

Return Download CRYENGINE: download CommunicationChannel.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 "CommunicationChannel.h"
  5.  
  6. CommunicationChannel::CommunicationChannel(const CommunicationChannel::Ptr& parent,
  7.                                            const SCommunicationChannelParams& params,
  8.                                            const CommChannelID& channelID)
  9.         : m_parent(parent)
  10.         , m_minSilence(params.minSilence)
  11.         , m_silence(0.0f)
  12.         , m_flushSilence(params.flushSilence)
  13.         , m_actorMinSilence(params.actorMinSilence)
  14.         , m_priority(params.priority)
  15.         , m_id(channelID)
  16.         , m_occupied(false)
  17.         , m_type(params.type)
  18.         , m_ignoreActorSilence(params.ignoreActorSilence)
  19. {}
  20.  
  21. void CommunicationChannel::Update(float updateTime)
  22. {
  23.         if (!m_occupied && (m_silence > 0.0f))
  24.                 m_silence -= updateTime;
  25. }
  26.  
  27. void CommunicationChannel::Occupy(bool occupy, float minSilence)
  28. {
  29.         assert((occupy && IsFree()) || (!occupy && !IsFree()));
  30.  
  31.         if (m_occupied && !occupy)
  32.                 m_silence = (minSilence >= 0.0f) ? minSilence : m_minSilence;
  33.         m_occupied = occupy;
  34.  
  35.         if (m_parent)
  36.                 m_parent->Occupy(occupy, minSilence);
  37.  
  38. }
  39.  
  40. bool CommunicationChannel::IsFree() const
  41. {
  42.         if (m_parent && !m_parent->IsFree())
  43.                 return false;
  44.  
  45.         return !m_occupied && (m_silence <= 0.0f);
  46. }
  47.  
  48. void CommunicationChannel::Clear()
  49. {
  50.         m_occupied = false;
  51.         m_silence = 0.0;
  52. }
  53.  
  54. void CommunicationChannel::ResetSilence()
  55. {
  56.         if (m_parent && !m_parent->IsOccupied())
  57.                 m_parent->ResetSilence();
  58.  
  59.         m_silence = m_flushSilence;
  60. }
  61.  
downloadCommunicationChannel.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