The moderators not allowed my question as long times. I shared my question from different platform and they answer.
Reward System Logic Problem
Guys hi. I Tried a making 3 star reward system and ı did it basicly. The system working normaly if ı pass the level under 7 step im earning 3 star. (int step <7 ) 3 Star (int step >7 and <12) 2 star (int step >12) 1 star so, here is the problem. For example ım earned 3 star in lvl 1. Later i played the lvl 1 again and ı pass the "level 1" >12 step. Code is change the stars to 1 stars. I want if ı earned before 3 star dont show 2 or 1 star. If ı earned 2 stars before dont show 1 star.
My c# skill not enough for writing to code this status.
LEVELS Class
public Sprite Star1;
public Sprite Star2;
public Sprite Star3;
public Image[] Stars;
void Start () {
//PlayerPrefs.SetInt("Level 1",1);
if (PlayerPrefs.GetInt("Level 1") ==1){
LevelNumbers[0].text = "1";
PlayerPrefs.SetInt("Level 1",1);
if (PlayerPrefs.GetInt("L1St")==1){
Stars[0].sprite = Star1;
}
else if (PlayerPrefs.GetInt("L1St")==2){
Stars[0].sprite = Star2;
}
else if (PlayerPrefs.GetInt("L1St")==3){
Stars[0].sprite = Star3;
}
}
void OnCollisionEnter(Collision coll) {
if (man1 == false & man2 == false &(coll.gameObject.tag=="Finish")) {
// Application.LoadLevel("Levels");
PlayerPrefs.SetInt("Level 1",1);
if(Application.loadedLevelName == "Level1"){
PlayerPrefs.SetInt("Level 2",1);
if(step >12 )
{
if (PlayerPrefs.GetInt("L1St") ==0){
PlayerPrefs.SetInt("L1St",1); /// Do 1 Star
}
}
if(step >7 && step <12 )
{
if (PlayerPrefs.GetInt("L1St") ==0 || PlayerPrefs.GetInt("L1St")==1 )
{
PlayerPrefs.SetInt("L1St",2); /// Do 2 Star
}
}
if(step <=7 )
{
if (PlayerPrefs.GetInt("L1St") ==0||PlayerPrefs.GetInt("L1St") ==1 || PlayerPrefs.GetInt("L1St") ==2 )
{
PlayerPrefs.SetInt("L1St",3); /// Do 3 Star
}
}
Application.LoadLevel("levels");
}
Follow this Question
Related Questions
CapsuleCollider check if grounded 1 Answer
How to Make A Character Stop At Wall? 0 Answers
problem with tilemap collider and composite collider 1 Answer
Animator and collision issues 0 Answers
Adding different values to randomly created objects 0 Answers