What on earth is happening here

Mar 21, 2016 at 7:32am
Why does the points value disregard that airtime is being rounded?
1
2
 scores = scores + Mathf.CeilToInt(airtime / 50);
         points = points + scores;

how do I fix this?
Mar 21, 2016 at 7:44am
You don't show enough context.
What are the types of airtime, scores and points?
What does the Mathf.CeilToInt() do?
Mar 21, 2016 at 7:45am
Ahhh .... more info?

What are the types?
Mar 21, 2016 at 8:10am
Mathf.CeilToInt basically rounds a float or decimal places to an int with the lowest number possible.

Scores, airtime and points are all integers, however when airtime is divided by 50, it may not be an integer so I need to round it.
Last edited on Mar 21, 2016 at 8:14am
Mar 21, 2016 at 8:22am
When you do divide an integer with an integer the result is always an integer where the fraction has been discarded.

E.g.
5/6 == 0
6/5 == 1
11/6 == 1
13/5 == 2
Topic archived. No new replies allowed.