DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ HandleEngineSound()

void HandleEngineSound ( MotorbikeEngineSoundState state)
protected

postpone the engine sound played from c++ on soundcontroller (via OnSound override)

См. определение в файле MotorbikeScript.c строка 1461

1462 {
1463 SetEngineSoundState(state);
1464 m_EngineLastSoundState = state;
1465
1466 #ifndef SERVER
1467 #ifndef NO_GUI
1468 PlayerBase player = null;
1469 EffectSound sound = null;
1470 WaveKind waveKind = WaveKind.WAVEEFFECTEX;
1471
1472 bool doInside = false;
1473
1474 m_EngineLastSoundState = state;
1475
1476 switch (state)
1477 {
1478 case MotorbikeEngineSoundState.STARTING:
1479 sound = new EffectSound();
1481 sound.SetSoundFadeOut(0.15);
1482
1483 m_PreStartSound = sound;
1484 break;
1485 case MotorbikeEngineSoundState.START_OK:
1486 doInside = true;
1487
1488 sound = new EffectSound();
1490 sound.SetAutodestroy(true);
1491
1493 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(SetEngineStarted, 1000, false, true);
1494 break;
1495
1496 case MotorbikeEngineSoundState.START_NO_FUEL:
1497 sound = new EffectSound();
1499 sound.SetAutodestroy(true);
1500 break;
1501
1502 case MotorbikeEngineSoundState.START_NO_SPARKPLUG:
1503 sound = new EffectSound();
1505 sound.SetAutodestroy(true);
1506 break;
1507
1508 case MotorbikeEngineSoundState.STOP_OK:
1509 doInside = true;
1510
1511 sound = new EffectSound();
1513 sound.SetAutodestroy(true);
1514 break;
1515 case MotorbikeEngineSoundState.STOP_NO_FUEL:
1516 doInside = true;
1517
1518 sound = new EffectSound();
1520 sound.SetAutodestroy(true);
1521 break;
1522
1523 default:
1524 break;
1525 }
1526
1527 // play different sound based on selected camera
1528 if (doInside && Class.CastTo(player, g_Game.GetPlayer()))
1529 {
1530 if (player.IsCameraInsideVehicle())
1531 {
1532 waveKind = WaveKind.WAVEEFFECT;
1533 }
1534 }
1535
1536 if (sound)
1537 {
1538 vector enginePos = GetEnginePos();
1539
1540 sound.SetParent(this);
1541 sound.SetPosition(ModelToWorld(enginePos));
1542 sound.SetLocalPosition(enginePos);
1543 sound.SetSoundWaveKind(waveKind);
1545
1546 sound.SoundPlay();
1547 }
1548
1549 #endif
1550 #endif
1551 }
DayZGame g_Game
Определения DayZGame.c:4074
proto native vector GetEnginePos()
Get actual position of engine (model space)
void SetEngineStarted(bool started)
Определения MotorbikeScript.c:1449
string m_EngineStartOK
Определения MotorbikeScript.c:89
string m_EngineStarting
Sounds.
Определения MotorbikeScript.c:88
string m_EngineStartPlug
Определения MotorbikeScript.c:91
ref EffectSound m_PreStartSound
Определения MotorbikeScript.c:95
string m_EngineStartFuel
Определения MotorbikeScript.c:92
MotorbikeEngineSoundState
Определения MotorbikeScript.c:43
MotorbikeEngineSoundState m_EngineLastSoundState
Определения MotorbikeScript.c:85
string m_EngineStopFuel
Определения MotorbikeScript.c:94
void SetEngineSoundState(MotorbikeEngineSoundState pState)
Определения MotorbikeScript.c:1455
string m_EngineStop
Определения MotorbikeScript.c:93
WaveKind
Определения Sound.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
void SetSoundSet(string snd)
Set soundset for the sound.
Определения EffectSound.c:798
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:607
void SetSoundWaveKind(WaveKind wave_kind)
Set WaveKind for the sound.
Определения EffectSound.c:788
void SetSoundFadeOut(float fade_out)
Set the sound fade out duration.
Определения EffectSound.c:908
override void SetParent(Object parent_obj, int pivot)
Set parent for the sound to follow.
Определения EffectSound.c:658
bool SoundPlay()
Plays sound.
Определения EffectSound.c:199
Wrapper class for managing sound through SEffectManager.
Определения EffectSound.c:5
Определения PlayerBaseClient.c:2
static int EffectRegister(Effect effect)
Registers Effect in SEffectManager.
Определения EffectManager.c:331
Manager class for managing Effect (EffectParticle, EffectSound)
Определения EffectManager.c:6
Определения EnConvert.c:119
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int CALL_CATEGORY_GAMEPLAY
Определения 3_Game/DayZ/tools/tools.c:10

Перекрестные ссылки CALL_CATEGORY_GAMEPLAY, Class::CastTo(), SEffectManager::EffectRegister(), g_Game, GetEnginePos(), m_EngineLastSoundState, m_EngineStartFuel, m_EngineStarting, m_EngineStartOK, m_EngineStartPlug, m_EngineStop, m_EngineStopFuel, m_PreStartSound, EffectSound::SetAutodestroy(), SetEngineSoundState(), SetEngineStarted(), EffectSound::SetParent(), EffectSound::SetSoundFadeOut(), EffectSound::SetSoundSet(), EffectSound::SetSoundWaveKind() и EffectSound::SoundPlay().

Используется в Car::OnEngineStart(), OnEngineStart(), Car::OnEngineStop(), OnEngineStop(), Car::OnIgnition(), OnIgnition(), Car::OnVariablesSynchronized() и OnVariablesSynchronized().