Hey, I have a health script which allows the player to take Damage via RPC. I also have an Armor system, but this system sometimes spits out decimals as a result. I was wondering if I could round Health so that no decimals are created?
(Note: Just ignore MyPlayer. if its just confusing you. It doesn’t really mean anything special.)
//If this function is triggered, subtract the amount of damage
//Recieved from health and armor
if(MyPlayer.DamageDone > 0)
{
if(MyPlayer.armor > 0)
{
//Half of Damage is Subtracted off Health
MyPlayer.health -= Damage/2;
//Full Damage is subracted from the Armor
MyPlayer.armor -= Damage;
//Tell us that the player has recieved damage
Debug.Log("Damage Recieved");
//Reset the Damage Notification
MyPlayer.DamageDone --;
//Set Regen Timer back to "0" so that the player cant
//Regenerate while being hit
MyPlayer.RegenTimerDuration = 0.0f;
}
}