Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - DarkSlash

Pages: [1]
1
DOTween & DOTween Pro / Re: Can't tween float
« on: September 20, 2015, 03:48:44 PM »
Oh! Thanks!

2
DOTween & DOTween Pro / Re: Can't tween float
« on: September 20, 2015, 03:36:55 PM »
Yes I think is the best solution. I got decimals when I tween a round value, but if only two decimals it doesn't look bad. I do ToString("F2") insted of Strinfromat

Thank you for your help!!

3
DOTween & DOTween Pro / Re: Can't tween float
« on: September 20, 2015, 03:15:39 PM »
Sorry, I edited my post while you were replying, I missed the last txtBalance = balance.ToString(); in the OnComplete function ;)
Ok, I can convert to int, tween them, and then add the decimal part. That's the only way?

4
DOTween & DOTween Pro / Re: Can't tween float
« on: September 20, 2015, 03:06:15 PM »
Oh, I though that OnComplete was called every time it completes doing every step in the tween but its called when the whole tween is complete. My mistake ;)

Also, there's a way to limit the decimals to just 2 in the floats? Or, if the number has not decimal part (1080), tween without decimals, if the number has decimals (1080.75) tween with decimals. Can this be done?

5
DOTween & DOTween Pro / Re: Can't tween float
« on: September 20, 2015, 01:55:28 AM »
Im not setting balance from anywhere else and my timeScale is the default. I have this on Start():  DOTween.Init(); do I have to do something else? Attach some script to the gameobject? Or initialice DOTween in another way? I'm calling DOTween.To(...) from a function, do I have to do it from Update() or somewhere special?

6
DOTween & DOTween Pro / Can't tween float
« on: September 20, 2015, 12:23:03 AM »
I have a float variable called balance and I show it in a 2d Toolkit TextMesh. Right now, Im doing something like this to change it:
Code: [Select]
balance += totalPayment;
UpdateUI();

But I don't want to change the value from A to B. Let's say balance = 50 and totalPayment = 150, I want to increase it 50,51,52,53 (or something like that) until 200 (balance + totalPayment). So the closest I got is this:

Code: [Select]
float to = balance + totalPayment;
DOTween.To(() => balance, x => balance = x, to, 2).OnComplete(UpdateUI);

Nevertheless, this doesn't work as expected. It doesn't do what I need, it just wait 2 seconds and then change the value of balance to balance+totalPayment. What I'm doing wrong?

EDIT: UpdateUI just take does this: txtBalance.text = balance.ToString("F2"); 

Pages: [1]