tick() public method

tick method. if it returns true it indicates the animation is complete
public tick ( float deltaTime ) : bool
deltaTime float
return bool
Ejemplo n.º 1
0
    void Update()
    {
        if (currentAnimation != null)
        {
            if (currentAnimation.tick(Time.deltaTime))
            {
                // animation done. handle the completion rule
                switch (currentAnimation.animationState.completeRule)
                {
                case SKSpriteAnimationState.CompleteRule.DestorySprite:
                    Destroy(gameObject);
                    break;

                case SKSpriteAnimationState.CompleteRule.HideSprite:
                    renderer.enabled = false;
                    break;

                case SKSpriteAnimationState.CompleteRule.RevertToOriginalSprite:
                    setUVs(spriteSheet.textureInfoForImage(sourceImageName).uvRect);
                    break;
                }

                currentAnimation = null;
            }
        }
    }