2020-12-13 15:01:13 +00:00
|
|
|
//=============================================================================
|
|
|
|
// KFGFxHUD_WaveInfo
|
|
|
|
//=============================================================================
|
|
|
|
// HUD container that stores information about the current wave.
|
|
|
|
//=============================================================================
|
|
|
|
// Killing Floor 2
|
|
|
|
// Copyright (C) 2015 Tripwire Interactive LLC
|
|
|
|
// - Alex Quick 5/28/2014
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
class KFGFxHUD_WaveInfo extends GFxObject;
|
|
|
|
|
|
|
|
/** Cached KFPlayerController */
|
|
|
|
var KFGameReplicationinfo KFGRI;
|
2021-03-02 11:56:51 +00:00
|
|
|
|
2020-12-13 15:01:13 +00:00
|
|
|
//
|
|
|
|
var int LastWaveMax;
|
|
|
|
//
|
|
|
|
var int LastZEDCount;
|
|
|
|
//
|
|
|
|
var int LastWave;
|
|
|
|
//
|
|
|
|
var int LastTraderTimeRemaining;
|
|
|
|
|
|
|
|
const ENDLESS_WAVE_ID = -2;
|
|
|
|
|
|
|
|
var KFPlayerController KFPC;
|
|
|
|
|
|
|
|
var localized string WaveString;
|
|
|
|
var localized string BossWaveString;
|
|
|
|
var localized string FinalWaveString;
|
|
|
|
|
|
|
|
var KFGFxHUD_ObjectiveConatiner ObjectiveContainer;
|
|
|
|
|
|
|
|
function InitializeHUD()
|
|
|
|
{
|
|
|
|
SetString("waveText", WaveString);
|
|
|
|
SetString("bossText", BossWaveString);
|
|
|
|
SetString("finalText", FinalWaveString);
|
|
|
|
UpdateWaveCount();
|
|
|
|
KFPC = KFPlayerController(GetPC());
|
|
|
|
}
|
|
|
|
|
|
|
|
function TickHud(float DeltaTime)
|
|
|
|
{
|
|
|
|
if(KFGRI == none)
|
|
|
|
{
|
|
|
|
KFGRI = KFGameReplicationInfo(GetPC().WorldInfo.GRI);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (KFGRI.bWaveIsActive && !KFGRI.bWaveStarted)
|
|
|
|
{
|
2021-03-02 11:56:51 +00:00
|
|
|
SetString("waitingForWaveStart", "-----");
|
2020-12-13 15:01:13 +00:00
|
|
|
}
|
|
|
|
else if (!KFGRI.bWaveIsActive)
|
2021-03-02 11:56:51 +00:00
|
|
|
{
|
2020-12-13 15:01:13 +00:00
|
|
|
UpdateTraderTimeRemaining();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
UpdateZEDCount();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ObjectiveContainer != none)
|
|
|
|
{
|
|
|
|
ObjectiveContainer.TickHud(DeltaTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function UpdateWaveCount()
|
|
|
|
{
|
2022-05-11 15:13:25 +00:00
|
|
|
local int CurrentWaveMax, CurrentWave;
|
2020-12-13 15:01:13 +00:00
|
|
|
|
|
|
|
if( KFGRI == none )
|
|
|
|
{
|
|
|
|
KFGRI = KFGameReplicationInfo( GetPC().WorldInfo.GRI );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( KFGRI == none )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-05-11 15:13:25 +00:00
|
|
|
if (KFGRI.bIsWeeklyMode && KFGRI.CurrentWeeklyIndex == 16)
|
|
|
|
{
|
|
|
|
CurrentWave = KFGRI.GunGameWavesCurrent;
|
|
|
|
CurrentWaveMax = KFGRI.GetFinalWaveNum();
|
2020-12-13 15:01:13 +00:00
|
|
|
|
2022-05-11 15:13:25 +00:00
|
|
|
if (KFGRI.bWaveGunGameIsFinal)
|
|
|
|
{
|
|
|
|
CurrentWave = CurrentWaveMax + 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CurrentWaveMax = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
Setint("maxGunGameWave" , CurrentWaveMax);
|
|
|
|
Setint("currentGunGameWave" , CurrentWave);
|
|
|
|
|
|
|
|
LastWaveMax = CurrentWaveMax;
|
2020-12-13 15:01:13 +00:00
|
|
|
LastWave = CurrentWave;
|
|
|
|
}
|
2022-05-11 15:13:25 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
CurrentWave = KFGRI.WaveNum;
|
|
|
|
CurrentWaveMax = KFGRI.GetFinalWaveNum();
|
|
|
|
|
|
|
|
// Max # of waves.
|
|
|
|
if (LastWaveMax != CurrentWaveMax)
|
|
|
|
{
|
|
|
|
SetInt("maxWaves" , KFGRI.default.bEndlessMode ? INDEX_NONE : CurrentWaveMax);
|
|
|
|
LastWaveMax = CurrentWaveMax;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Current wave we're on.
|
|
|
|
if (CurrentWave != LastWave)
|
|
|
|
{
|
|
|
|
SetInt("currentWave" , CurrentWave);
|
|
|
|
|
|
|
|
LastWave = CurrentWave;
|
|
|
|
}
|
|
|
|
}
|
2020-12-13 15:01:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function UpdateZEDCount()
|
|
|
|
{
|
|
|
|
local int CurrentZEDCount;
|
|
|
|
|
|
|
|
if( KFGRI == none )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(KFGRI.IsBossWave())
|
|
|
|
{
|
|
|
|
SetInt("remainingZEDs" , INDEX_NONE);
|
|
|
|
LastZEDCount = -1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (KFGRI.IsEndlessWave())
|
|
|
|
{
|
|
|
|
SetInt("remainingZEDs", ENDLESS_WAVE_ID);
|
|
|
|
LastZEDCount = -1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// # of ZEDs left to kill in this wave.
|
|
|
|
CurrentZEDCount = KFGRI.AIRemaining;
|
|
|
|
if(LastZEDCount != CurrentZEDCount)
|
|
|
|
{
|
|
|
|
SetInt("remainingZEDs" ,CurrentZEDCount);
|
|
|
|
LastZEDCount = CurrentZEDCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function UpdateTraderTimeRemaining()
|
|
|
|
{
|
|
|
|
local int CurrentTraderTimeRemaining;
|
|
|
|
|
|
|
|
if( KFGRI == none )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CurrentTraderTimeRemaining = KFGRI.GetTraderTimeRemaining();
|
|
|
|
if(LastTraderTimeRemaining != CurrentTraderTimeRemaining)
|
|
|
|
{
|
|
|
|
SetInt("remainingTraderTime" ,CurrentTraderTimeRemaining);
|
|
|
|
LastTraderTimeRemaining = CurrentTraderTimeRemaining;
|
|
|
|
if (LastTraderTimeRemaining < 10 && LastTraderTimeRemaining >= 0)
|
|
|
|
{
|
|
|
|
if (KFPC != none && KFPC.MyGFxHUD != none)
|
|
|
|
{
|
|
|
|
KFPC.MyGFxHUD.PlaySoundFromTheme('TraderTime_Countdown', 'UI');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DefaultProperties
|
|
|
|
{
|
|
|
|
LastTraderTimeRemaining=0
|
|
|
|
LastZEDCount=0
|
|
|
|
}
|