Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

TribesGUI.HUDHealthBarTurret


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
class HUDHealthBarTurret extends HUDValueBar;

var() config HUDMaterial	lowHealthAlertMaterial;
var() config float			lowHealthThreshold;

//
// Updates the data
function UpdateData(ClientSideCharacter c)
{
	value = c.turretHealth;
	maximumValue = c.turretHealthMaximum;

	super.UpdateData(c);
}

//
// Renders the element. Overridden here due to the special requirements
// of the effects on the health bar when healing & losing health
//
function RenderElement(Canvas C)
{
	local float oldClipX;

	// dont want to call the super render, otherwise we 
	// will get extra layuers rendering that we dont want
//	super.RenderElement(C);

	// calc the actual health ratio
	CalculateRatio();

	// draw the empty bar
	RenderHUDMaterial(C, activeEmptyTexture, Width, Height);
	// DrawTile sets CurX, CurY
	C.CurX = 0;
	C.CurY = 0;

	// Clip to the current bar value
	ClipToValue(C, activeFullTexture, ratio);

	if(ratio < lowHealthThreshold)
		// low health flashy warning alert thingy
		RenderHUDMaterial(C, lowHealthAlertMaterial, Width, Height);
	else
		// normal bar
		RenderHUDMaterial(C, activeFullTexture, Width, Height);
	
	// DrawTile sets CurX, CurY
	C.CurX = 0;
	C.CurY = 0;

	// return to the old clip
	C.ClipX = oldClipX;
}

defaultproperties
{
	lowHealthThreshold = 0.25
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: st 16.4.2014 10:20:44.000 - Creation time: st 23.5.2018 00:10:44.306 - Created with UnCodeX