Fixed Healthtube, optimized/fixed Breathtube

MimmoO 2011-09-19 19:01:44 +02:00
parent 0d051873c1
commit fff38554d7
2 changed files with 16 additions and 8 deletions

View File

@ -17,6 +17,7 @@ local backpack;
// optimizations
local updated_health_tube;
local updated_breath_tube;
protected func Construction()
{
@ -77,12 +78,12 @@ protected func Construction()
private func ScheduleUpdateHealthBar()
{
Schedule(this, "UpdateHUDHealthBar()", 1, 0);
ScheduleCall(this, "UpdateHUDHealthBar", 1, 0, this->GetOwner());
}
private func ScheduleUpdateBackpack()
{
Schedule(this, "UpdateBackpack()", 1, 0);
ScheduleCall(this, "UpdateBackpack", 1, 0, this->GetOwner());
}
protected func OnWealthChanged(int plr)
@ -94,6 +95,7 @@ protected func OnWealthChanged(int plr)
protected func MakeHealthTube()
{
var btube = CreateObject(GUI_HealthTube,0,0,this->GetOwner());
btube->SetPosition(1,-1);
btube->MakeBot();
@ -125,7 +127,7 @@ protected func MakeBreathTube()
tube->SetTubes(ftube);
tube->Update();
AddEffect("Update",tube,100,1,tube);
updated_breath_tube=tube;
tubes[GetLength(tubes)] = tube;
tubes[GetLength(tubes)] = ftube;
}
@ -179,7 +181,7 @@ global func AddHUDMarker(int player, picture, string altpicture, string text, in
}
global func UpdateHUDHealthBar(player)
private func UpdateHUDHealthBar(player)
{
var o = FindObject(Find_ID(GUI_Controller), Find_Owner(player));
if(!o) return;
@ -188,7 +190,7 @@ global func UpdateHUDHealthBar(player)
AddEffect("Update", o.updated_health_tube, 1, 1, o.updated_health_tube);
}
global func UpdateBackpack(player)
private func UpdateBackpack(player)
{
var o = FindObject(Find_ID(GUI_Controller), Find_Owner(player));
if(!o) return;

View File

@ -23,12 +23,18 @@ protected func Construction()
visible = false;
}
public func ShowBreathTube()
{
if(!GetEffect("Update", this))
AddEffect("Update", this, 1, 1, this);
}
public func FxUpdateTimer(target, effect, time)
{
if(!visible)
effect.Interval = 20;
else effect.Interval = 1;
visible=true;
Update();
if(!visible)
return -1;
}
public func Update()