Game Development Reference
In-Depth Information
//Check if ammo empty
if(_ammo <= 0)
{
//Call expired event
OnAmmoExpired();
return;
}
}
}
//-------------------------------------------------------
//Internal variables for health and ammo
private int _health = 100;
private int _ammo = 50;
//-------------------------------------------------------
// Update is called once per frame
void Update ()
{
}
//-------------------------------------------------------
//This event is called when health is low
void OnHealthLow()
{
//Handle event response here
}
//-------------------------------------------------------
//This event is called when enemy is dead
void OnDead()
{
//Handle event response here
}
//-------------------------------------------------------
//Ammo run out event
void OnAmmoExpired()
{
//Handle event response here
}
//-------------------------------------------------------
}
 
Search WWH ::




Custom Search