Пример #1
0
        public void ClearData()
        {
            clip            = null;
            lastClip        = null;
            renderer.sprite = null;

            isPlaying  = false;
            isComplete = true;
        }
Пример #2
0
        public void UpdateClip(bool force = false)
        {
            if (!avatarData || !spriteAnimation)
            {
                lastAngle  = angle;
                lastAction = action;
                return;
            }
//			Debug.Log("UpdateClip");

            if (lastAction != action || force)
            {
                avatarAction = avatarData.GetAvatarAction(action);
            }

            if (avatarAction != null)
            {
//				if (force || lastAngle != angle || lastAction != action)
//				{
                SpriteAnimationClip clip = avatarAction.GetSpriteAnimationClip(angle);

                if (clip != null)
                {
                    spriteAnimation.clip      = clip;
                    spriteAnimation.frameTime = avatarAction.frameTime;
                    spriteIsometric.flip      = clip.flip;

                    if (!spriteAnimation.IsPlaying || lastAction != action)
                    {
                        spriteAnimation.Play();
                    }
                }
                else
                {
                    Debug.Log("<color=red> action=" + action + " angle=" + angle + "avatarAction is null" + "</color>");
                    spriteAnimation.clip = null;
                    spriteIsometric.flip = false;
                }
//				}
            }
            else
            {
//				Debug.Log("<color=red> action=" + action+ " is null"  + "</color>");
                spriteAnimation.clip = null;
                spriteIsometric.flip = false;
            }

            lastAction           = action;
            lastAngle            = angle;
            isSendActionComplete = false;
        }