I [re-read the manual][1] and found out how to do it using StopByName and StartCoroutine. This works:
int comboScore = 0;
IEnumerator ChangeNumber(int num) {
UILabel label = number.GetComponent();
label.text = ""+num;
iTween.StopByName("ComboAnim");
// Have to manually reset scale otherwise combo gets bigger
number.transform.localScale = new Vector3(baseSize, baseSize, 1);
yield return new WaitForSeconds(0.01f);
iTween.PunchScale(number,
iTween.Hash(
"name","ComboAnim",
"amount",new Vector3(scaleUp, scaleUp, 1),
"time",1/speed
)
);
}
void Update() {
if (Input.GetKeyDown("up")) { // Debugging purposes
comboScore++;
StartCoroutine(ChangeNumber(comboScore));
}
}
[1]: http://itween.pixelplacement.com/documentation.php#StopByName
Trending Articles
More Pages to Explore .....