Пример #1
0
        internal void PlayersPlay(string bonesArea, MyAnimationDefinition animDefinition, bool firstPerson, MyFrameOption frameOption, float blendTime, float timeScale)
        {
            string[] players = bonesArea.Split(' ');

            if (animDefinition.AnimationSets != null)
            {
                foreach (var animationSet in animDefinition.AnimationSets)
                {
                    var animationSetData = new MyAnimationSetData()
                    {
                        BlendTime    = blendTime,
                        Area         = bonesArea,
                        AnimationSet = animationSet
                    };

                    if (animationSet.Continuous)
                    {
                        m_continuingAnimSets.Add(animationSetData);
                        continue;
                    }

                    PlayAnimationSet(animationSetData);
                }

                return;
            }

            foreach (var player in players)
            {
                PlayerPlay(player, animDefinition, firstPerson, frameOption, blendTime, timeScale);
            }
        }
Пример #2
0
        void PlayAnimationSet(MyAnimationSetData animationSetData)
        {
            if (MyRandom.Instance.NextFloat(0, 1) < animationSetData.AnimationSet.Probability)
            {
                float total = animationSetData.AnimationSet.AnimationItems.Sum(x => x.Ratio);
                if (total > 0)
                {
                    float r   = MyRandom.Instance.NextFloat(0, 1);
                    float rel = 0;
                    foreach (var animationItem in animationSetData.AnimationSet.AnimationItems)
                    {
                        rel += animationItem.Ratio / total;

                        if (r < rel)
                        {
                            var command = new MyAnimationCommand()
                            {
                                AnimationSubtypeName = animationItem.Animation,
                                PlaybackCommand      = MyPlaybackCommand.Play,
                                Area      = animationSetData.Area,
                                BlendTime = animationSetData.BlendTime,
                                TimeScale = 1,
                                KeepContinuingAnimations = true
                            };

                            ProcessCommand(ref command);
                            break;
                        }
                    }
                }
            }
        }
Пример #3
0
        internal void PlayersPlay(string bonesArea, MyAnimationDefinition animDefinition, bool firstPerson, MyFrameOption frameOption, float blendTime, float timeScale)
        {
            string[] players = bonesArea.Split(' ');

            if (animDefinition.AnimationSets != null)
            {
                foreach (var animationSet in animDefinition.AnimationSets)
                {
                    var animationSetData = new MyAnimationSetData()
                        {
                            BlendTime = blendTime,
                            Area = bonesArea,
                            AnimationSet = animationSet
                        };

                    if (animationSet.Continuous)
                    {
                        m_continuingAnimSets.Add(animationSetData);
                        continue;
                    }

                    PlayAnimationSet(animationSetData);
                }

                return;
            }

            foreach (var player in players)
            {
                PlayerPlay(player, animDefinition, firstPerson, frameOption, blendTime, timeScale);
            }
        }
Пример #4
0
        void PlayAnimationSet(MyAnimationSetData animationSetData)
        {
            if (MyRandom.Instance.NextFloat(0, 1) < animationSetData.AnimationSet.Probability)
            {
                float total = animationSetData.AnimationSet.AnimationItems.Sum(x => x.Ratio);
                if (total > 0)
                {
                    float r = MyRandom.Instance.NextFloat(0, 1);
                    float rel = 0;
                    foreach (var animationItem in animationSetData.AnimationSet.AnimationItems)
                    {
                        rel += animationItem.Ratio / total;

                        if (r < rel)
                        {
                            var command = new MyAnimationCommand()
                            {
                                AnimationSubtypeName = animationItem.Animation,
                                PlaybackCommand = MyPlaybackCommand.Play,
                                Area = animationSetData.Area,
                                BlendTime = animationSetData.BlendTime,
                                TimeScale = 1,
                                KeepContinuingAnimations = true
                            };

                            ProcessCommand(ref command);
                            break;
                        }
                    }
                }
            }
        }