- Home /
I dont want Decimals :P
This is easy I guess.. every time the character ends a level, a GUI text displays the exp earned for ex "+100!".
this is the exp earned variable:
expEarned = Health / GameObject.Find("Time").GetComponent<TimeCounter>().time * (level * _level.GetComponent<LevelStats>().levelDifficulty) * 10;
All the exp related vars are floats, so sometimes, the GUI text displays for example "+123.0567!"
so..what I want to do is to round the exp earned so it doesent display any decimals.
I'm Using "C#"
Comment
Best Answer
Answer by CarlLawl · Jun 12, 2011 at 12:35 AM
Hey,
Check out FloorToInt, i Think it's what you're looking for! http://unity3d.com/support/documentation/ScriptReference/Mathf.FloorToInt.html
or roundtoint http://unity3d.com/support/documentation/ScriptReference/Mathf.RoundToInt.html