public void PlayCharacterAnimation( string animationName, MyBlendOption blendOption, MyFrameOption frameOption, float blendTime, float timeScale = 1, bool sync = false, string influenceArea = null, //use defined boneset area from character definitions bool excludeLegsWhenMoving = false ) { bool disableAnimations = MySandboxGame.IsDedicated && MyPerGameSettings.DisableAnimationsOnDS; if (disableAnimations && !sync) { return; } if (!m_animationCommandsEnabled) { return; } if (animationName == null) { System.Diagnostics.Debug.Fail("Cannot play null animation!"); return; } string animationSubtype = null; if (!m_characterDefinition.AnimationNameToSubtypeName.TryGetValue(animationName, out animationSubtype)) { animationSubtype = animationName; } var command = new MyAnimationCommand() { AnimationSubtypeName = animationSubtype, PlaybackCommand = MyPlaybackCommand.Play, BlendOption = blendOption, FrameOption = frameOption, BlendTime = blendTime, TimeScale = timeScale, Area = influenceArea, ExcludeLegsWhenMoving = excludeLegsWhenMoving }; // CH: If we don't want to play the animation ourselves, but it has to be synced, we have to send it to clients at least if (disableAnimations && sync) { SyncObject.SendAnimationCommand(ref command); } else { AddCommand(command, sync); } }
public override void AddCommand(MyAnimationCommand command, bool sync = false) { base.AddCommand(command, sync); if (sync) { SyncObject.SendAnimationCommand(ref command); } }