Hello Guest

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.


Topics - Neeko

Pages: 1 [2]
16
I have a cooldown timer sprite animator whose animation clip I want to play for a variable number of seconds. So for example one instance the animation clip will take 60 seconds to complete, or take 10 seconds to complete.

I know of the ClipFps property, and I've been fiddling around with it's value, but I can't seem to figure out what I should be setting it at based on the number of seconds I want the clip to take.

Here's a code sample, maybe there's a better way to do this?
Code: [Select]
// Take 60 seconds to cooldown.
CooldownTime = 60f;
StartCoroutine(CooldownTimer());

private IEnumerator CooldownTimer() {
    cooldownSprite.Play("cooldown");
    cooldownSprite.ClipFps = CooldownTime;
    CooldownFinished = false;
    yield return new WaitForSeconds(CooldownTime);
    cooldownSprite.Play("ready");
    CooldownFinished = true;
}

Pages: 1 [2]