コード例 #1
0
    private void Update()
    {
        if (fps == 0)
        {
            return;
        }

        if (_innerTimer > (1f / fps))
        {
            if (fps > 0)
            {
                frame++;
                if (frame > clip.Size - 1)
                {
                    frame = 0;
                    if (transitionMap.ContainsKey(clip))
                    {
                        clip = transitionMap[clip];
                    }
                }
                sr.sprite = clip.GetSprite(frame);
            }
            else
            {
                frame--;
                if (frame < 0)
                {
                    frame = clip.Size - 1;
                }
                sr.sprite = clip.GetSprite(frame);
            }

            _innerTimer = 0f;
        }

        _innerTimer += Time.deltaTime;
    }