DayZ 1.24
Loading...
Searching...
No Matches
SpookyEventBase Class Reference
Inheritance diagram for SpookyEventBase:
[legend]
Collaboration diagram for SpookyEventBase:
[legend]

Protected Member Functions

void SpookyEventBase ()
 
void Init ()
 
vector GetMatchingSurfacePos (TStringArray surfaces, TStringVectorMap gatheredSurfaces)
 
void SetCoolDown (float secs)
 
bool HasSurfaces ()
 
bool CanDo (PlayerBase player, TStringVectorMap surfaceTypes)
 
void Do (PlayerBase player)
 
bool CanPerform (PlayerBase player, float currentTime, TStringVectorMap surfaceTypes)
 
void Perform (PlayerBase player, float currentTime, TStringVectorMap gatheredSurfaces)
 
vector GetSoundPos (PlayerBase player)
 

Protected Attributes

float m_PerformedTimestamp
 
int m_Cooldown
 
string m_SoundSet
 
ref TStringArray m_Surfaces
 
vector m_MatchingSurfacePos
 

Detailed Description

Definition at line 84 of file SpookyAreaMisc.c.

Constructor & Destructor Documentation

◆ SpookyEventBase()

void SpookyEventBase::SpookyEventBase ( )
inlineprotected

Definition at line 94 of file SpookyAreaMisc.c.

95 {
96 Init();
97 }

References Init().

Member Function Documentation

◆ CanDo()

bool SpookyEventBase::CanDo ( PlayerBase player,
TStringVectorMap surfaceTypes )
inlineprotected

Definition at line 127 of file SpookyAreaMisc.c.

128 {
129 return true;
130 }

Referenced by CanPerform().

◆ CanPerform()

bool SpookyEventBase::CanPerform ( PlayerBase player,
float currentTime,
TStringVectorMap surfaceTypes )
inlineprotected

Definition at line 135 of file SpookyAreaMisc.c.

136 {
137 bool surfaceCheckResult = 1;
138
139 if (HasSurfaces())
140 {
143 }
144
145
147 }
bool CanDo(PlayerBase player, TStringVectorMap surfaceTypes)
ref TStringArray m_Surfaces
vector m_MatchingSurfacePos
vector GetMatchingSurfacePos(TStringArray surfaces, TStringVectorMap gatheredSurfaces)
static const vector Zero
Definition EnConvert.c:110

References CanDo(), GetMatchingSurfacePos(), HasSurfaces(), m_Cooldown, m_MatchingSurfacePos, m_PerformedTimestamp, m_Surfaces, and vector::Zero.

◆ Do()

void SpookyEventBase::Do ( PlayerBase player)
protected

Referenced by Perform().

◆ GetMatchingSurfacePos()

vector SpookyEventBase::GetMatchingSurfacePos ( TStringArray surfaces,
TStringVectorMap gatheredSurfaces )
inlineprotected

Definition at line 102 of file SpookyAreaMisc.c.

103 {
104 for (int i = 0; i < gatheredSurfaces.Count(); i++)
105 {
106 string currSurface = gatheredSurfaces.GetKey(i);
107 foreach (string s: surfaces)
108 {
109 if (currSurface.Contains(s))
110 return gatheredSurfaces.Get(currSurface);
111 }
112 }
113
114 return vector.Zero;
115 }

References vector::Zero.

Referenced by CanPerform().

◆ GetSoundPos()

vector SpookyEventBase::GetSoundPos ( PlayerBase player)
inlineprotected

Definition at line 173 of file SpookyAreaMisc.c.

174 {
176
177 if (HasSurfaces())
179 else
180 {
181 float distance = Math.RandomFloatInclusive(5, 15);
183 vector playerPos = player.GetPosition();
185 }
186
187 return soundPos;
188 }
Definition EnMath.c:7
static vector RandomDir2D()
Returns randomly generated XZ unit vector with the Y(up) axis set to 0.
Definition EnConvert.c:260
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:106

References HasSurfaces(), m_MatchingSurfacePos, vector::RandomDir2D(), and Math::RandomFloatInclusive().

Referenced by Perform().

◆ HasSurfaces()

bool SpookyEventBase::HasSurfaces ( )
inlineprotected

Definition at line 122 of file SpookyAreaMisc.c.

123 {
124 return (m_Surfaces && m_Surfaces.Count() > 0);
125 }

References m_Surfaces.

Referenced by CanPerform(), and GetSoundPos().

◆ Init()

void SpookyEventBase::Init ( )
protected

Referenced by SpookyEventBase().

◆ Perform()

void SpookyEventBase::Perform ( PlayerBase player,
float currentTime,
TStringVectorMap gatheredSurfaces )
inlineprotected

Definition at line 150 of file SpookyAreaMisc.c.

151 {
152#ifdef DIAG_DEVELOPER
153 if (DiagMenu.GetBool(DiagMenuIDs.TRIGGER_DEBUG))
154 Print("Performing " + this);
155#endif
157
158 if (m_SoundSet)
159 {
162 sound.SetAutodestroy(true);
163
164#ifdef DIAG_DEVELOPER
165 if (DiagMenu.GetBool(DiagMenuIDs.TRIGGER_DEBUG))
166 Debug.DrawSphere(soundPos, 0.15, Colors.YELLOW, ShapeFlags.NOZBUFFER);
167#endif
168 }
169
170 Do(player);
171 }
DiagMenuIDs
Definition EDiagMenuIDs.c:2
Definition Colors.c:4
const int YELLOW
Definition Colors.c:10
Definition Debug.c:14
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
Definition Debug.c:434
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
Manager class for managing Effect (EffectParticle, EffectSound)
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
void Do(PlayerBase player)
vector GetSoundPos(PlayerBase player)
proto void Print(void var)
Prints content of variable to console/log.
ShapeFlags
Definition EnDebug.c:126
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.

References Do(), Debug::DrawSphere(), DiagMenu::GetBool(), GetSoundPos(), m_PerformedTimestamp, m_SoundSet, SEffectManager::PlaySound(), Print(), and Colors::YELLOW.

◆ SetCoolDown()

void SpookyEventBase::SetCoolDown ( float secs)
inlineprotected

Definition at line 117 of file SpookyAreaMisc.c.

118 {
119 m_Cooldown = secs * 1000;
120 }

References m_Cooldown.

Referenced by SpookyEventWind::Init(), and SpookyEventSteps::Init().

Member Data Documentation

◆ m_Cooldown

int SpookyEventBase::m_Cooldown
protected

Definition at line 88 of file SpookyAreaMisc.c.

Referenced by CanPerform(), and SetCoolDown().

◆ m_MatchingSurfacePos

vector SpookyEventBase::m_MatchingSurfacePos
protected

Definition at line 92 of file SpookyAreaMisc.c.

Referenced by CanPerform(), and GetSoundPos().

◆ m_PerformedTimestamp

float SpookyEventBase::m_PerformedTimestamp
protected

Definition at line 87 of file SpookyAreaMisc.c.

Referenced by CanPerform(), and Perform().

◆ m_SoundSet

string SpookyEventBase::m_SoundSet
protected

Definition at line 90 of file SpookyAreaMisc.c.

Referenced by SpookyEventWind::Init(), SpookyEventSteps::Init(), and Perform().

◆ m_Surfaces

ref TStringArray SpookyEventBase::m_Surfaces
protected

Definition at line 91 of file SpookyAreaMisc.c.

Referenced by CanPerform(), HasSurfaces(), and SpookyEventSteps::Init().


The documentation for this class was generated from the following file: