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 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 ) { 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; } AddCommand(new MyAnimationCommand() { AnimationSubtypeName = animationSubtype, PlaybackCommand = MyPlaybackCommand.Play, BlendOption = blendOption, FrameOption = frameOption, BlendTime = blendTime, TimeScale = timeScale, Area = influenceArea, ExcludeLegsWhenMoving = excludeLegsWhenMoving }, sync); }
private MyBlendOption AdjustSafeAnimationEnd(MyBlendOption idealEnd) { //wait for previous end is important ie. for turning animation. You must wait until previous turning animation ends MyBlendOption end = MyBlendOption.Immediate; if (m_currentAnimationChangeDelay > SAFE_DELAY_FOR_ANIMATION_BLEND) end = idealEnd; return end; }
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 ) { if (UseNewAnimationSystem) return; 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 // MZ: when sync is on, we always want to send the message if (sync) { SendAnimationCommand(ref command); } else { // if animations are disabled and sync is off, don't do anything if (!disableAnimations) AddCommand(command, sync); } }