Game Development Reference
In-Depth Information
HealthBar.transform.LookAt(Camera.main.transform);
DamageReport.color = txtColor;
if(Time.time > (SpawnTime + PreviousTime))
{
DamageReport.text = Damage.ToString();
txtColor.a = 1;
if(!HasChanged)
{
currentHealth -= Damage;
ChangeBar();
}
}
if(Time.time > (KillTime + PreviousTime))
{
DamageReport.text = "";
txtColor.a = 0;
PreviousTime = Time.time;
HasChanged = false;
}
}
The first two lines of the function haven't changed, but they should remain at the top
of the function. The next line sets the color of our TextMesh to our color variable.
Now we will encounter our first timer:
if(Time.time > (SpawnTime + PreviousTime))
{
DamageReport.text = Damage.ToString();
txtColor.a = 1;
if(!HasChanged)
{
currentHealth -= Damage;
ChangeBar();
Search WWH ::




Custom Search