work with increment

Hey there i am a armature with unity. I want to give a increment condition for…(Please read below):
I have three object enemy,player,bullet. Enemy is falling down from very top & we have to shot that by bullet. If we missed the enemy 3 times then one life will decrease. So, what should be the increment condition. I used

Player.Missed++;
if(Player.Missed == 3)
{
Player.Life–;
}

but it works only for one time. I want it in every three enemy missed. If Missed number will be 3 & Life number will be three. Then Life number should be 2 & If Missed number will be 6. Then Life number should be 1. Please help me.

You can use modulus. The following will cause the players life to be decreased by 1 each time the value of Player.Missed is a multiple of 3.


if(Player.Missed != 0 && (Player.Missed % 3 == 0))
    Player.Life--;

This way, when Player.Missed is 3, 6, 9…, Player.Life will be decreased by 1.