Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
avatar image
0
Question by W1zzel · Nov 06, 2019 at 12:20 AM · score systemlevel-designscript referencing

What is the best way to create this Scoresystem ?

Hi, i am currently trying to create a Gamewide System which gets the highest score from Google Play Games and then create Stages based on that Score. For example :

Highscore = 1000

  • Stage 1 0 - 100 Score

  • Stage 2 100-200 Score

  • Stage 3 200 -300 Score

and so on. I want to calculate the Stages in my GameManager script and then. based on the current Stage, change some variables in other scripts such as Enemy Spawnrate and so on. I as a beginner can only think of a switch statement at this point.

What would be the cleanest solution for this ? Thanks in advance !

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by AconitumNapellum · Nov 06, 2019 at 12:17 PM

Highscore = 999

Calculate stage:

 int stage = Mathf.Floor(highscore / 100);

In this case you would get 9 (999/100 = 9.99, Mathf.Floor returns 9)

After calculating stage, multiply spawnrate, speed, etc... by stage number to get incrementing values each time you get on a new stage.

Mathf.Floor

Comment
Add comment · Show 5 · Share
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 W1zzel · Nov 07, 2019 at 12:34 AM 0
Share

Okay i think i didnt make it clear what i am trying to achieve, sorry. I want to set the stages based on the current Highscore.

So if the Highscore is 1000 i want the Stages to range from :

  • Stage 1 : 0-100 ((Highscore/10) 1) - ((Highscore/10) 1,9)

  • Stage 2 : 100-200((Highscore/10) 2) - ((Highscore/10) 2,9)

  • Stage 3 : 200-300(Highscore/10 3) - ((Highscore/10) 3,9)

and so on. So like i said i want to calculate this in my Gamemanager and inform every other script which stage the player currently is in. $$anonymous$$y question is : How do i set the current stage in the Gamemanager and change the values in other scripts based on the stage ? I can only think of a switch statement for the enemyspawn script for example something like :

void Update (){ switch Stage { case 1 : spawnrate 10% case 2 : spawnrate 20% }

but i don't know how to impelemt this properly or if this is even the right way to do this. I have to make an enum for this to work right ?

Thanks for your answer !

avatar image AconitumNapellum W1zzel · Nov 07, 2019 at 09:09 AM 1
Share

I still don't get how you're calculating your stages, but you should use a simple math algorithm made by yourself to change behaviours on scene based on the stage you're currently on. Using a switch statement limits you to a set number of cases, and that's not ideal. You should really use a value given by highscore to calculate spawnrate, speed, etc.

If you're thinking of checking your stage number with a switch case why not just multiplying stage number by 10? That gives you 10% spawnrate for stage number 1, 20% for stage number 2, etc..

avatar image W1zzel AconitumNapellum · Nov 07, 2019 at 12:51 PM 0
Share

Yeah i am not explaining it too well, am i. :D

Lets say my goal is to create 5 Stages with a variable starting and ending-score. So the higher the highscore gets, the longer the player will be in each stage.

How i calculate them, doesnt matter at the moment. $$anonymous$$y question revolves around how to efficiently inform other scripts about what stage i am in.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

116 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I use PlayerPrefs to save My Score? 2 Answers

I am having trouble making a High score system. I am trying to write the the top 5 highscores to a file and cannot use PlayerPrefs ,I need help with a high score system 0 Answers

How do I change variable value in other script, so my UI score will be 0 1 Answer

Painting Scoring system 2 Answers

Help with simple issue (hopefully) 1 Answer


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