Hi
i like to show unity video ad when player health is 0. So when i add show ad function in it then many ads start showing becuase this is added in update function. But i like to set ad show only ones with if field. i already tired bool way but this is not working for me because i also need health if field in my ad show function. Down -- if (health <0) in this field i like to show ad only ones in update
public void Death()
{
if (health <= 0)
{
gameOverCanvas.SetActive(true);
myrb.gravityScale = 1;
healthText.enabled = false;
ScoreManager.Instance.scoreShowText.enabled = (false);
Ads = false;
}
if (health <= 6)
{
mainSprite.color = Color.yellow;
spriteOutside.color = Color.yellow;
leftEye.sprite = mediumHealthEyeLeft;
rightEye.sprite = mediumHealthEyeRight;
mouth.sprite = mediumHealthMouth;
}
if (health <= 3)
{
mainSprite.color = Color.red;
healthText.color = Color.red;
spriteOutside.color = Color.red;
leftEye.sprite = lowHealthEyeLeft;
rightEye.sprite = lowHealthEyeRight;
mouth.sprite = lowHealthMouth;
}
}
↧