Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
This question was closed Oct 20, 2015 at 04:20 AM by martlost for the following reason:

The moderators not allowed my question as long times. I shared my question from different platform and they answer.

avatar image
0
Question by martlost · Oct 19, 2015 at 11:36 PM · c#collisionlogic

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");

         }
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image martlost · Oct 20, 2015 at 04:21 AM 0
Share

Solution = http://stackoverflow.com/questions/33221599/unity-3d-3-star-reward-system-logic-c/33222931#33222931

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

35 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges