Ejemplo n.º 1
0
        private static void RefreshStaticAttackAnimation(
            IComponentSkeleton skeletonRenderer,
            IProtoItemWeapon weapon,
            string firingAnimationName)
        {
            // ReSharper disable once CanExtractXamlLocalizableStringCSharp
            var staticFiringAnimationName = firingAnimationName + "_Static";
            var lastStaticAnimationName   = skeletonRenderer.GetLatestAddedAnimationName(
                AnimationTrackIndexes.ItemFiringStatic);

            if (lastStaticAnimationName == staticFiringAnimationName)
            {
                return;
            }

            if (skeletonRenderer.GetLatestAddedAnimationName(AnimationTrackIndexes.ItemFiring)
                == null)
            {
                // no current firing animation - no need the static animation
                return;
            }

            // need to update the static attack animation
            SetFiringAnimation(
                weapon,
                skeletonRenderer,
                AnimationTrackIndexes.ItemFiringStatic,
                staticFiringAnimationName,
                weapon.FireAnimationDuration,
                weapon.FireInterval,
                mixWithCurrent: true,
                isLooped: weapon.IsLoopedAttackAnimation);

            // synchronize static with non-static animation tracks
            skeletonRenderer.SetAnimationTime(
                AnimationTrackIndexes.ItemFiringStatic,
                skeletonRenderer.GetAnimationTime(AnimationTrackIndexes.ItemFiring));
        }