Пример #1
0
        public override void OnSkeletonCreated(IComponentSkeleton skeleton)
        {
            base.OnSkeletonCreated(skeleton);

            skeleton.RemoveAttachmentAnimationsForSlot("Weapon");

            skeleton.SetDefaultMixDuration(0.3f);

            skeleton.SetMixDuration("Torch", 0.25f);
            skeleton.SetMixDuration("Torch2", 0.15f);

            skeleton.SetMixDuration("Fishing_In", 0.1f);
            skeleton.SetMixDuration("Fishing_Out", 0.1f);

            // instant transition from death to idle animation
            skeleton.SetMixDuration("Idle", "Death", secondsMixAB: 0.2f, secondsMixBA: 0);

            // setup attack animations
            {
                var mixIn       = 0.033333f;
                var mixInStatic = 0.15f;
                var mixOut      = 0.15f;
                // fast mix-in into attacks, slower mix-out
                skeleton.SetMixDuration(null, "AttackMeleeHorizontal", mixIn, mixOut);
                skeleton.SetMixDuration(null, "AttackMeleeHorizontal_Static", mixInStatic, mixOut);
                skeleton.SetMixDuration(null, "AttackMeleeVertical", mixIn, mixOut);
                skeleton.SetMixDuration(null, "AttackMeleeVertical_Static", mixInStatic, mixOut);

                // fast mix between attacks
                skeleton.SetMixDuration("AttackMeleeHorizontal", "AttackMeleeVertical", mixIn, mixIn);
                skeleton.SetMixDuration("AttackMeleeHorizontal_Static", "AttackMeleeVertical_Static", mixIn, mixIn);
            }

            // disable mix for these movement animations
            DisableMoveMix("RunUp");
            DisableMoveMix("RunDown");
            DisableMoveMix("RunSide");
            DisableMoveMix("RunSideBackward");

            var verticalSpeedMultiplier = 1.1f;

            skeleton.SetAnimationDefaultSpeed("RunUp", verticalSpeedMultiplier);
            skeleton.SetAnimationDefaultSpeed("RunUpStart", verticalSpeedMultiplier);
            skeleton.SetAnimationDefaultSpeed("RunDown", verticalSpeedMultiplier);
            skeleton.SetAnimationDefaultSpeed("RunDownStart", verticalSpeedMultiplier);

            void DisableMoveMix(string primaryName)
            {
                var startName      = primaryName + "Start";
                var startAbortName = startName + "Abort";
                var minMix         = 0.05f;

                skeleton.SetMixDuration(startName, minMix);
                skeleton.SetMixDuration(startAbortName, minMix);
                skeleton.SetMixDuration("Idle", startName, minMix);
                // in theory there should be no mixing but we have to apply some
                // as end state of the movement start animation is not always perfectly matching
                // the start state of the movement animation
                skeleton.SetMixDuration(startName, primaryName, minMix);
                skeleton.SetMixDuration(startName, startAbortName, minMix);
                skeleton.SetMixDuration(startAbortName, "Idle", minMix);

                skeleton.SetAnimationDefaultSpeed(startAbortName, 1.3f);
            }
        }