Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using UnityEngine;
- public class CurrencyConverter : MonoBehaviour
- {
- private static CurrencyConverter instance;
- public static CurrencyConverter Instance {
- get {
- return instance;
- }
- }
- void Awake(){
- CreateInstance ();
- }
- void CreateInstance () {
- if (instance == null) {
- instance == this;
- }
- }
- public string GetCurrencyIntoString(float valueToConvert){
- string converted;
- if (valueToConvert >= 1000000) {
- converted = (valueToConvert / 1000f).ToString("f3") + " Mil";
- } else if (valueToConvert >= 1000) {
- converted = (valueToConvert / 1000f).ToString("f3") + " K";
- } else {
- converted = ("f0") + "" + valueToConvert;
- }
- }
- }
- return converted;
Add Comment
Please, Sign In to add comment