Once the user has finished watching the rewarded video ad, I want to give the user 3 additional lives and let the user continue the game from where the player died along with the same score.
I have been able to add the extra lives code but am not able to get the same score.
This is the score script:
public int playerScore = 0;
if (!isDead && collision.tag == "ScoreChecker") {
gameManager.AddToScore();
}
public void AddToScore()
{
playerScore++;
if (playerScore > PlayerPrefs.GetInt("HighScore",0))
{
PlayerPrefs.SetInt("HighScore", playerScore);
Debug.Log("Highscore");
}
Debug.Log("player score" + playerScore);
}
This is the extra lives reward script:
public void ReceiveReward()
{
totalLives = 3;
UIManager.instance.UpdateLivesIcons();
UIManager.instance.RewardPanel.SetActive(false);
}
I have been able to reward the extra lives, but not sure how to let the user continue with the same score when the player died.