Exemple #1
0
 private void SetActiveCursorAnimation(CursorAnimation cursorAnim)
 {
     this._cursorAnimation = cursorAnim;
     _currentFrame         = 0;
     _frameTimer           = 0;
     _frameCount           = _cursorAnimation.textureArray.Length;
 }
 void SetActiveCursorAnimation(CursorAnimation cursorAnimation)
 {
     this.cursorAnimation = cursorAnimation;
     currentFrame         = 0;
     frameTimer           = cursorAnimation.frameRate;
     frameCount           = cursorAnimation.textureArray.Length;
 }
Exemple #3
0
    private void LoopAnimation(CursorAnimation cursorAnimation)
    {
        if (animationIndex >= cursorAnimation.animation.Length)
        {
            animationIndex = 0;
        }

        Cursor.SetCursor(cursorAnimation.animation[animationIndex], hotSpot, cursorMode);

        animationIndex++;
    }
    private IEnumerator PlayAnimation(CursorAnimation cursorAnim)
    {
        float duration = cursorAnim.duration / cursorAnim.textures.Length;

        do
        {
            foreach (Texture2D texture in cursorAnim.textures)
            {
                SetCursor(texture);
                yield return(new WaitForSeconds(duration));
            }
        } while (cursorAnim.looping);

        SetCursor(defaultCursor);
        currentAnimationCoroutine = null;
    }
    public void StartPlayAnimation(string animName)
    {
        if (currentAnimationCoroutine != null)
        {
            StopCoroutine(currentAnimationCoroutine);
        }

        if (!animationDictionary.ContainsKey(animName))
        {
            Debug.LogError("Cursor animation does not exist with name: " + animName);
            return;
        }

        CursorAnimation cursorAnimation = animationDictionary[animName];

        currentAnimationCoroutine = StartCoroutine(PlayAnimation(cursorAnimation));
    }
Exemple #6
0
 public void Play(CursorAnimation animation)
 {
     animator.Play(animationHash[(int)animation - 1]);
 }
Exemple #7
0
 void AnimateCursor(CursorAnimation cursorAnim)
 {
 }