-- #Script.ReloadScript("scripts/default/hud/heatvision.lua")

--------------------------------------------------------------------
-- FarCry Script File
-- Description: Defines CryVision
-- Tiago Sousa
--------------------------------------------------------------------

HeatVision = {	
	EnergyDecreaseRate = 7.5,
	ActivateSnd=Sound:LoadSound("sounds/items/nvisionactivate.wav"),
	PrevAmbientColor=nil,	
	IsActive=0,
}

-------------------------------------------------------
function HeatVision:OnInit()	
	HeatVision.IsActive=0;
end

-------------------------------------------------------
function HeatVision:OnActivate()
ai_ignoreplayer = 1;			
_localplayer.iPlayerEffect = 5; 
HeatVision.IsActive=1;
end

-------------------------------------------------------
function HeatVision:OnDeactivate(nofade)
HeatVision.IsActive=0;
_localplayer.iPlayerEffect = 1; 
ai_ignoreplayer = 0;
end

-------------------------------------------------------
function HeatVision:OnUpdate()
	 --subtract energy
	local MyPlayer=_localplayer;
	MyPlayer.ChangeEnergy( MyPlayer, _frametime * -self.EnergyDecreaseRate );	
end
-------------------------------------------------------
function HeatVision:OnShutdown()	
	HeatVision.IsActive=0;
end

-------------------------------------------------------
function HeatVision:OnRestore(pRestoreTbl)
HeatVision.IsActive=pRestoreTbl.IsActive;
end
