DayZ 1.24
Loading...
Searching...
No Matches
PlayerSoundManager.c File Reference

Go to the source code of this file.

Classes

class  PlayerSoundManagerBase
 

Enumerations

enum  eSoundHandlers {
  STAMINA , HUNGER , INJURY , THIRST ,
  COUNT
}
 

Functions

void PlayerSoundManagerBase (PlayerBase player)
 
void RegisterHandler (SoundHandlerBase handler)
 
SoundHandlerBase GetHandler (eSoundHandlers id)
 
void Init ()
 Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)
 
void Update ()
 
void PlayerSoundManagerClient (PlayerBase player)
 
void SetAllowUpdate (bool enable)
 
void CheckAllowUpdate ()
 

Variables

const float SOUNDS_HEARING_DISTANCE = 50
 
enum eSoundHandlers m_Player
 
const int MAX_HANDLERS_COUNT = eSoundHandlers.COUNT
 
ref SoundHandlerBase m_Handlers [MAX_HANDLERS_COUNT]
 
class PlayerSoundManagerServer extends PlayerSoundManagerBase m_ClientCharacterTick = new Timer
 
ref Timer m_ClientCharacterDistanceCheck = new Timer
 
bool m_UpdateTimerRunning
 

Enumeration Type Documentation

◆ eSoundHandlers

Enumerator
STAMINA 
HUNGER 
INJURY 
THIRST 
COUNT 

Definition at line 4 of file PlayerSoundManager.c.

5{
7 HUNGER,
8 INJURY,
9 THIRST,
10 //FREEZING,
11
12 //------
13 // add stuff above !
14 //------
15 COUNT
16}
@ INJURY
@ THIRST
@ HUNGER
@ STAMINA

Function Documentation

◆ CheckAllowUpdate()

void CheckAllowUpdate ( )

Definition at line 132 of file PlayerSoundManager.c.

133 {
134 if (GetGame().GetPlayer())
135 {
137
139 SetAllowUpdate(false);
141 SetAllowUpdate(true);
142 //PrintString("distance:" + vector.Distance(GetGame().GetPlayer().GetPosition(), m_Player.GetPosition()).ToString());
143 }
144 }
PlayerBase GetPlayer()
void SetAllowUpdate(bool enable)
const float SOUNDS_HEARING_DISTANCE
bool m_UpdateTimerRunning
enum eSoundHandlers m_Player
class JsonUndergroundAreaTriggerData GetPosition
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()

References vector::Distance(), GetGame(), GetPlayer(), GetPosition, m_Player, m_UpdateTimerRunning, SetAllowUpdate(), and SOUNDS_HEARING_DISTANCE.

◆ GetHandler()

SoundHandlerBase GetHandler ( eSoundHandlers id)

Definition at line 38 of file PlayerSoundManager.c.

39 {
40 return m_Handlers[id];
41 }
ref SoundHandlerBase m_Handlers[MAX_HANDLERS_COUNT]

References m_Handlers.

◆ Init()

void Init ( )

Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)

Definition at line 43 of file PlayerSoundManager.c.

44 {
45
46 }

◆ PlayerSoundManagerBase()

void PlayerSoundManagerBase ( PlayerBase player)

Definition at line 26 of file PlayerSoundManager.c.

27 {
29 Init();
30 }
void Init()
Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside o...

References PlayerSoundManagerBase::Init(), and m_Player.

◆ PlayerSoundManagerClient()

void PlayerSoundManagerClient ( PlayerBase player)

Definition at line 97 of file PlayerSoundManager.c.

98 {
99
100 if (!GetGame().IsDedicatedServer())
101 m_ClientCharacterDistanceCheck.Run(2, this, "CheckAllowUpdate", null, true);
102 }
ref Timer m_ClientCharacterDistanceCheck

References GetGame(), and m_ClientCharacterDistanceCheck.

Referenced by ManBase::Init().

◆ RegisterHandler()

void RegisterHandler ( SoundHandlerBase handler)

Definition at line 32 of file PlayerSoundManager.c.

33 {
34 int index = handler.GetID();
36 }

References m_Handlers.

Referenced by PlayerSoundManagerBase::Init().

◆ SetAllowUpdate()

void SetAllowUpdate ( bool enable)

Definition at line 104 of file PlayerSoundManager.c.

105 {
106 if (enable)
107 {
109 m_ClientCharacterTick.Run(0.03, this, "Update", null, true);
110 }
111 else
112 {
113 m_UpdateTimerRunning = false;
115 }
116 }
class PlayerSoundManagerServer extends PlayerSoundManagerBase m_ClientCharacterTick

References m_ClientCharacterTick, and m_UpdateTimerRunning.

Referenced by CheckAllowUpdate(), and Update().

Variable Documentation

◆ m_ClientCharacterDistanceCheck

ref Timer m_ClientCharacterDistanceCheck = new Timer

Definition at line 82 of file PlayerSoundManager.c.

Referenced by PlayerSoundManagerClient().

◆ m_ClientCharacterTick

◆ m_Handlers

◆ m_Player

enum eSoundHandlers m_Player

Referenced by PlayerSoundManagerBase().

◆ m_UpdateTimerRunning

bool m_UpdateTimerRunning

Definition at line 83 of file PlayerSoundManager.c.

Referenced by CheckAllowUpdate(), and SetAllowUpdate().

◆ MAX_HANDLERS_COUNT

const int MAX_HANDLERS_COUNT = eSoundHandlers.COUNT

Definition at line 23 of file PlayerSoundManager.c.

Referenced by Update(), and PlayerSoundManagerBase::Update().

◆ SOUNDS_HEARING_DISTANCE

const float SOUNDS_HEARING_DISTANCE = 50

Definition at line 2 of file PlayerSoundManager.c.

Referenced by CheckAllowUpdate().