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

TribesGUI.HUDEnergyBar


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
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
class HUDEnergyBar extends HUDValueBar;

var() config HUDMaterial	depletionMaterial;
var() config float			depletionFadeTime;

var float energyWeaponDepleted;
var float depletionAlpha;
var float depletionStartTime;
var float depletionStartRatio;

function UpdateData(ClientSideCharacter c)
{
	bVisible = c.bShowEnergyBar;
	if(bVisible)
	{
		value = c.energy;
		maximumValue = c.energyMaximum;

		if(c.energyWeaponDepleted > 0)
		{
			energyWeaponDepleted = c.energyWeaponDepleted;
			depletionStartRatio = FClamp(value / maximumValue, 0.0, 1.0);

			depletionMaterial.fadeStartTime = c.levelTimeSeconds;
			depletionMaterial.fadeProgress = 0;
		}
	}

	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;
	local float depletionRatio;

	// 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;

	// want to render the usual full texture here,
	// only clipped to the point that the healthInjection
	// will finish
	oldClipX = C.ClipX;	
	if(energyWeaponDepleted > 0)
	{
		depletionRatio = FClamp((energyWeaponDepleted / maximumValue) + depletionStartRatio, 0.0, 1.0);
		ClipToValue(C, depletionMaterial, depletionRatio);
		RenderHUDMaterial(C, depletionMaterial, Width, Height);
		// DrawTile sets CurX, CurY
		C.CurX = 0;
		C.CurY = 0;
	}

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

	// draw the full bar, clipped to the ratio
	RenderHUDMaterial(C, activeFullTexture, Width, Height);
	// DrawTile sets CurX, CurY
	C.CurX = 0;
	C.CurY = 0;
	
	// return to the old clip
	C.ClipX = oldClipX;
}

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.264 - Created with UnCodeX