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); } }
bool TryGetAnimationDefinition(string animationSubtypeName, out MyAnimationDefinition animDefinition) { if (animationSubtypeName == null) { animDefinition = null; return(false); } animDefinition = MyDefinitionManager.Static.TryGetAnimationDefinition(animationSubtypeName); if (animDefinition == null) { //Try backward compatibility //Backward compatibility string oldPath = System.IO.Path.Combine(MyFileSystem.ContentPath, animationSubtypeName); if (MyFileSystem.FileExists(oldPath)) { animDefinition = new MyAnimationDefinition() { AnimationModel = oldPath, ClipIndex = 0, }; return(true); } animDefinition = null; return(false); } return(true); }
internal void PlayerPlay(string playerName, MyAnimationDefinition animDefinition, bool firstPerson, MyFrameOption frameOption, float blendTime, float timeScale) { MyAnimationPlayerBlendPair player; if (TryGetAnimationPlayer(playerName, out player)) { player.Play(animDefinition, firstPerson, frameOption, blendTime, timeScale); } // else // Debug.Fail("Non existing animation set"); }
protected override void OnAnimationPlay(MyAnimationDefinition animDefinition, MyAnimationCommand command, ref string bonesArea, ref MyFrameOption frameOption, ref bool useFirstPersonVersion) { var currentMovementState = GetCurrentMovementState(); if (DefinitionId.Value.SubtypeId == medievelMaleSubtypeId) { if (command.ExcludeLegsWhenMoving) { //In this case, we must stop all upper animations correctly if (currentMovementState == MyCharacterMovementEnum.RotatingLeft || currentMovementState == MyCharacterMovementEnum.RotatingRight || currentMovementState == MyCharacterMovementEnum.Standing) { bonesArea = TopBody + " LowerBody"; } else { bonesArea = TopBody; } frameOption = frameOption != MyFrameOption.JustFirstFrame ? MyFrameOption.PlayOnce : frameOption; } else if (m_lastBonesArea == TopBody + " LowerBody") { StopLowerCharacterAnimation(0.2f); } m_lastBonesArea = bonesArea; } else { if (currentMovementState != MyCharacterMovementEnum.Standing && currentMovementState != MyCharacterMovementEnum.RotatingLeft && currentMovementState != MyCharacterMovementEnum.RotatingRight && command.ExcludeLegsWhenMoving) { //In this case, we must stop all upper animations correctly bonesArea = TopBody; frameOption = frameOption != MyFrameOption.JustFirstFrame ? MyFrameOption.PlayOnce : frameOption; } } useFirstPersonVersion = IsInFirstPersonView; if (animDefinition.AllowWithWeapon) { if (!UseAnimationForWeapon) { UseAnimationForWeapon = true; m_resetWeaponAnimationState = true; } } }
public void Play(MyAnimationDefinition animationDefinition, bool firstPerson, MyFrameOption frameOption, float blendTime, float timeScale) { string model = firstPerson && !string.IsNullOrEmpty(animationDefinition.AnimationModelFPS) ? animationDefinition.AnimationModelFPS : animationDefinition.AnimationModel; System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(model)); if (string.IsNullOrEmpty(animationDefinition.AnimationModel)) { return; } if (animationDefinition.Status == MyAnimationDefinition.AnimationStatus.Unchecked) { var fsPath = System.IO.Path.IsPathRooted(model) ? model : System.IO.Path.Combine(MyFileSystem.ContentPath, model); if (!MyFileSystem.FileExists(fsPath)) { animationDefinition.Status = MyAnimationDefinition.AnimationStatus.Failed; return; } } animationDefinition.Status = MyAnimationDefinition.AnimationStatus.OK; MyModel animation = VRage.Game.Models.MyModels.GetModelOnlyAnimationData(model); Debug.Assert(animation != null && animation.Animations != null && animation.Animations.Clips.Count > 0); if (animation != null && animation.Animations == null || animation.Animations.Clips.Count == 0) { return; } Debug.Assert(animationDefinition.ClipIndex < animation.Animations.Clips.Count); if (animation.Animations.Clips.Count <= animationDefinition.ClipIndex) { return; } if (ActualPlayer.IsInitialized) { BlendPlayer.Initialize(ActualPlayer); } // Create a clip player and assign it to this model ActualPlayer.Initialize(animation, m_name, animationDefinition.ClipIndex, m_skinnedEntity, 1, timeScale, frameOption, m_bones, m_boneLODs); ActualPlayer.AnimationMwmPathDebug = model; ActualPlayer.AnimationNameDebug = animationDefinition.Id.SubtypeName; m_state = AnimationBlendState.BlendIn; m_currentBlendTime = 0; m_totalBlendTime = blendTime; }
protected override void OnAnimationPlay(MyAnimationDefinition animDefinition, MyAnimationCommand command, ref string bonesArea, ref MyFrameOption frameOption, ref bool useFirstPersonVersion) { if (GetCurrentMovementState() != MyCharacterMovementEnum.Standing && GetCurrentMovementState() != MyCharacterMovementEnum.RotatingLeft && GetCurrentMovementState() != MyCharacterMovementEnum.RotatingRight && command.ExcludeLegsWhenMoving) { //In this case, we must stop all upper animations correctly bonesArea = TopBody; frameOption = MyFrameOption.None; } useFirstPersonVersion = IsInFirstPersonView; if (animDefinition.AllowWithWeapon) { if (!UseAnimationForWeapon) { StoreWeaponRelativeMatrix(); UseAnimationForWeapon = true; m_resetWeaponAnimationState = true; } } if (!animDefinition.LeftHandItem.TypeId.IsNull) { if (m_leftHandItem != null) { (m_leftHandItem as IMyHandheldGunObject <Sandbox.Game.Weapons.MyDeviceBase>).OnControlReleased(); m_leftHandItem.Close(); } m_leftHandItem = MyEntityFactory.CreateEntity(animDefinition.LeftHandItem.TypeId); var ob = MyEntityFactory.CreateObjectBuilder(m_leftHandItem); m_leftHandItem.Init(ob); (m_leftHandItem as IMyHandheldGunObject <Sandbox.Game.Weapons.MyDeviceBase>).OnControlAcquired(this); UpdateLeftHandItemPosition(); MyEntities.Add(m_leftHandItem); } }
public void Play(MyAnimationDefinition animationDefinition, bool firstPerson, MyFrameOption frameOption, float blendTime, float timeScale) { string animationModel; if (!firstPerson || string.IsNullOrEmpty(animationDefinition.AnimationModelFPS)) { animationModel = animationDefinition.AnimationModel; } else { animationModel = animationDefinition.AnimationModelFPS; } string path = animationModel; if (!string.IsNullOrEmpty(animationDefinition.AnimationModel)) { if ((animationDefinition.Status == MyAnimationDefinition.AnimationStatus.Unchecked) && !MyFileSystem.FileExists(Path.IsPathRooted(path) ? path : Path.Combine(MyFileSystem.ContentPath, path))) { animationDefinition.Status = MyAnimationDefinition.AnimationStatus.Failed; } else { animationDefinition.Status = MyAnimationDefinition.AnimationStatus.OK; MyModel modelOnlyAnimationData = MyModels.GetModelOnlyAnimationData(path, false); if ((((modelOnlyAnimationData == null) || (modelOnlyAnimationData.Animations != null)) && (modelOnlyAnimationData.Animations.Clips.Count != 0)) && (modelOnlyAnimationData.Animations.Clips.Count > animationDefinition.ClipIndex)) { if (this.ActualPlayer.IsInitialized) { this.BlendPlayer.Initialize(this.ActualPlayer); } this.ActualPlayer.Initialize(modelOnlyAnimationData, this.m_name, animationDefinition.ClipIndex, this.m_skinnedEntity, 1f, timeScale, frameOption, this.m_bones, this.m_boneLODs); this.ActualPlayer.AnimationMwmPathDebug = path; this.ActualPlayer.AnimationNameDebug = animationDefinition.Id.SubtypeName; this.m_state = AnimationBlendState.BlendIn; this.m_currentBlendTime = 0f; this.m_totalBlendTime = blendTime; } } } }
public void Play(MyAnimationDefinition animationDefinition, bool loop, float blendTime, float timeScale, bool justFirstFrame) { System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(animationDefinition.AnimationModel)); if (string.IsNullOrEmpty(animationDefinition.AnimationModel)) { return; } MyModel animation = MyModels.GetModelOnlyAnimationData(animationDefinition.AnimationModel); System.Diagnostics.Debug.Assert(animation.Animations.Clips.Count > 0); if (animation.Animations.Clips.Count == 0) { return; } System.Diagnostics.Debug.Assert(animationDefinition.ClipIndex < animation.Animations.Clips.Count); if (animation.Animations.Clips.Count <= animationDefinition.ClipIndex) { return; } AnimationClip clip = animation.Animations.Clips[animationDefinition.ClipIndex]; if (ActualPlayer.IsInitialized) { BlendPlayer.Initialize(ActualPlayer); } // Create a clip player and assign it to this model ActualPlayer.Initialize(clip, m_character, 1, timeScale, justFirstFrame, m_bones); ActualPlayer.Looping = loop; m_state = AnimationBlendState.BlendIn; m_currentBlendTime = 0; m_totalBlendTime = blendTime; }
protected override void OnAnimationPlay(MyAnimationDefinition animDefinition,MyAnimationCommand command, ref string bonesArea, ref MyFrameOption frameOption, ref bool useFirstPersonVersion) { var currentMovementState = GetCurrentMovementState(); if (DefinitionId.Value.SubtypeId == medievelMaleSubtypeId) { if (command.ExcludeLegsWhenMoving) { //In this case, we must stop all upper animations correctly if (currentMovementState == MyCharacterMovementEnum.RotatingLeft || currentMovementState == MyCharacterMovementEnum.RotatingRight || currentMovementState == MyCharacterMovementEnum.Standing) bonesArea = TopBody + " LowerBody"; else bonesArea = TopBody; frameOption = frameOption != MyFrameOption.JustFirstFrame ? MyFrameOption.PlayOnce : frameOption; } else if (m_lastBonesArea == TopBody + " LowerBody") StopLowerCharacterAnimation(0.2f); m_lastBonesArea = bonesArea; } else { if (currentMovementState != MyCharacterMovementEnum.Standing && currentMovementState != MyCharacterMovementEnum.RotatingLeft && currentMovementState != MyCharacterMovementEnum.RotatingRight && command.ExcludeLegsWhenMoving) { //In this case, we must stop all upper animations correctly bonesArea = TopBody; frameOption = frameOption != MyFrameOption.JustFirstFrame ? MyFrameOption.PlayOnce : frameOption; } } useFirstPersonVersion = IsInFirstPersonView; if (animDefinition.AllowWithWeapon) { if (!UseAnimationForWeapon) { UseAnimationForWeapon = true; m_resetWeaponAnimationState = true; } } }
protected override void OnAnimationPlay(MyAnimationDefinition animDefinition,MyAnimationCommand command, ref string bonesArea, ref MyFrameOption frameOption, ref bool useFirstPersonVersion) { var currentMovementState = GetCurrentMovementState(); if (DefinitionId.Value.SubtypeId == medievelMaleSubtypeId) { if (command.ExcludeLegsWhenMoving) { //In this case, we must stop all upper animations correctly if (currentMovementState == MyCharacterMovementEnum.RotatingLeft || currentMovementState == MyCharacterMovementEnum.RotatingRight || currentMovementState == MyCharacterMovementEnum.Standing) bonesArea = TopBody + " LowerBody"; else bonesArea = TopBody; frameOption = frameOption != MyFrameOption.JustFirstFrame ? MyFrameOption.PlayOnce : frameOption; } else if (m_lastBonesArea == TopBody + " LowerBody") StopLowerCharacterAnimation(0.2f); m_lastBonesArea = bonesArea; } else { if (currentMovementState != MyCharacterMovementEnum.Standing && currentMovementState != MyCharacterMovementEnum.RotatingLeft && currentMovementState != MyCharacterMovementEnum.RotatingRight && command.ExcludeLegsWhenMoving) { //In this case, we must stop all upper animations correctly bonesArea = TopBody; frameOption = frameOption != MyFrameOption.JustFirstFrame ? MyFrameOption.PlayOnce : frameOption; } } useFirstPersonVersion = IsInFirstPersonView; if (animDefinition.AllowWithWeapon) { if (!UseAnimationForWeapon) { StoreWeaponRelativeMatrix(); UseAnimationForWeapon = true; m_resetWeaponAnimationState = true; } } if (!animDefinition.LeftHandItem.TypeId.IsNull) { if (m_leftHandItem != null) { (m_leftHandItem as IMyHandheldGunObject<Sandbox.Game.Weapons.MyDeviceBase>).OnControlReleased(); m_leftHandItem.Close(); } // CH: TODO: The entity id is not synced, but it never was in this place. It should be fixed later long handItemId = MyEntityIdentifier.AllocateId(); uint? inventoryItemId = null; var builder = GetObjectBuilderForWeapon(animDefinition.LeftHandItem, ref inventoryItemId, handItemId); var leftHandItem = CreateGun(builder, inventoryItemId); if (leftHandItem != null) { m_leftHandItem = leftHandItem as MyEntity; leftHandItem.OnControlAcquired(this); UpdateLeftHandItemPosition(); MyEntities.Add(m_leftHandItem); } } }
public void Play(MyAnimationDefinition animationDefinition, bool firstPerson, MyFrameOption frameOption, float blendTime, float timeScale) { string model = firstPerson && !string.IsNullOrEmpty(animationDefinition.AnimationModelFPS) ? animationDefinition.AnimationModelFPS : animationDefinition.AnimationModel; System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(model)); if (string.IsNullOrEmpty(animationDefinition.AnimationModel)) return; if (animationDefinition.Status == MyAnimationDefinition.AnimationStatus.Unchecked) { var fsPath = System.IO.Path.IsPathRooted(model) ? model : System.IO.Path.Combine(MyFileSystem.ContentPath, model); if (!MyFileSystem.FileExists(fsPath)) { animationDefinition.Status = MyAnimationDefinition.AnimationStatus.Failed; return; } } animationDefinition.Status = MyAnimationDefinition.AnimationStatus.OK; MyModel animation = VRage.Game.Models.MyModels.GetModelOnlyAnimationData(model); Debug.Assert(animation != null && animation.Animations != null && animation.Animations.Clips.Count > 0); if (animation != null && animation.Animations == null || animation.Animations.Clips.Count == 0) return; Debug.Assert(animationDefinition.ClipIndex < animation.Animations.Clips.Count); if (animation.Animations.Clips.Count <= animationDefinition.ClipIndex) return; if (ActualPlayer.IsInitialized) { BlendPlayer.Initialize(ActualPlayer); } // Create a clip player and assign it to this model ActualPlayer.Initialize(animation, m_name, animationDefinition.ClipIndex, m_skinnedEntity, 1, timeScale, frameOption, m_bones, m_boneLODs); ActualPlayer.AnimationMwmPathDebug = model; ActualPlayer.AnimationNameDebug = animationDefinition.Id.SubtypeName; m_state = AnimationBlendState.BlendIn; m_currentBlendTime = 0; m_totalBlendTime = blendTime; }
protected virtual void OnAnimationPlay(MyAnimationDefinition animDefinition, MyAnimationCommand command, ref string bonesArea, ref MyFrameOption frameOption, ref bool useFirstPersonVersion) { }
protected override void OnAnimationPlay(MyAnimationDefinition animDefinition,MyAnimationCommand command, ref string bonesArea, ref MyFrameOption frameOption, ref bool useFirstPersonVersion) { var currentMovementState = GetCurrentMovementState(); if (DefinitionId.Value.SubtypeId == medievelMaleSubtypeId) { if (command.ExcludeLegsWhenMoving) { //In this case, we must stop all upper animations correctly if (currentMovementState == MyCharacterMovementEnum.RotatingLeft || currentMovementState == MyCharacterMovementEnum.RotatingRight || currentMovementState == MyCharacterMovementEnum.Standing) bonesArea = TopBody + " LowerBody"; else bonesArea = TopBody; frameOption = frameOption != MyFrameOption.JustFirstFrame ? MyFrameOption.PlayOnce : frameOption; } else if (m_lastBonesArea == TopBody + " LowerBody") StopLowerCharacterAnimation(0.2f); m_lastBonesArea = bonesArea; } else { if (currentMovementState != MyCharacterMovementEnum.Standing && currentMovementState != MyCharacterMovementEnum.RotatingLeft && currentMovementState != MyCharacterMovementEnum.RotatingRight && command.ExcludeLegsWhenMoving) { //In this case, we must stop all upper animations correctly bonesArea = TopBody; frameOption = frameOption != MyFrameOption.JustFirstFrame ? MyFrameOption.PlayOnce : frameOption; } } useFirstPersonVersion = IsInFirstPersonView; if (animDefinition.AllowWithWeapon) { if (!UseAnimationForWeapon) { StoreWeaponRelativeMatrix(); UseAnimationForWeapon = true; m_resetWeaponAnimationState = true; } } if (!animDefinition.LeftHandItem.TypeId.IsNull) { if (m_leftHandItem != null) { (m_leftHandItem as IMyHandheldGunObject<Sandbox.Game.Weapons.MyDeviceBase>).OnControlReleased(); m_leftHandItem.Close(); } m_leftHandItem = MyEntityFactory.CreateEntity(animDefinition.LeftHandItem.TypeId); var ob = MyEntityFactory.CreateObjectBuilder(m_leftHandItem); m_leftHandItem.Init(ob); var leftHandTool = m_leftHandItem as IMyHandheldGunObject<Sandbox.Game.Weapons.MyDeviceBase>; if (leftHandTool != null) { leftHandTool.OnControlAcquired(this); } (m_leftHandItem as IMyHandheldGunObject<Sandbox.Game.Weapons.MyDeviceBase>).OnControlAcquired(this); UpdateLeftHandItemPosition(); MyEntities.Add(m_leftHandItem); } }
protected override void OnAnimationPlay(MyAnimationDefinition animDefinition, MyAnimationCommand command, ref string bonesArea, ref MyFrameOption frameOption, ref bool useFirstPersonVersion) { var currentMovementState = GetCurrentMovementState(); if (DefinitionId.Value.SubtypeId == medievelMaleSubtypeId) { if (command.ExcludeLegsWhenMoving) { //In this case, we must stop all upper animations correctly if (currentMovementState == MyCharacterMovementEnum.RotatingLeft || currentMovementState == MyCharacterMovementEnum.RotatingRight || currentMovementState == MyCharacterMovementEnum.Standing) { bonesArea = TopBody + " LowerBody"; } else { bonesArea = TopBody; } frameOption = frameOption != MyFrameOption.JustFirstFrame ? MyFrameOption.PlayOnce : frameOption; } else if (m_lastBonesArea == TopBody + " LowerBody") { StopLowerCharacterAnimation(0.2f); } m_lastBonesArea = bonesArea; } else { if (currentMovementState != MyCharacterMovementEnum.Standing && currentMovementState != MyCharacterMovementEnum.RotatingLeft && currentMovementState != MyCharacterMovementEnum.RotatingRight && command.ExcludeLegsWhenMoving) { //In this case, we must stop all upper animations correctly bonesArea = TopBody; frameOption = frameOption != MyFrameOption.JustFirstFrame ? MyFrameOption.PlayOnce : frameOption; } } useFirstPersonVersion = IsInFirstPersonView; if (animDefinition.AllowWithWeapon) { if (!UseAnimationForWeapon) { StoreWeaponRelativeMatrix(); UseAnimationForWeapon = true; m_resetWeaponAnimationState = true; } } if (!animDefinition.LeftHandItem.TypeId.IsNull) { if (m_leftHandItem != null) { (m_leftHandItem as IMyHandheldGunObject <Sandbox.Game.Weapons.MyDeviceBase>).OnControlReleased(); m_leftHandItem.Close(); } // CH: TODO: The entity id is not synced, but it never was in this place. It should be fixed later long handItemId = MyEntityIdentifier.AllocateId(); uint?inventoryItemId = null; var builder = GetObjectBuilderForWeapon(animDefinition.LeftHandItem, ref inventoryItemId, handItemId); var leftHandItem = CreateGun(builder, inventoryItemId); if (leftHandItem != null) { m_leftHandItem = leftHandItem as MyEntity; leftHandItem.OnControlAcquired(this); UpdateLeftHandItemPosition(); MyEntities.Add(m_leftHandItem); } } }
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); } }
protected override void OnAnimationPlay(MyAnimationDefinition animDefinition, MyAnimationCommand command, ref string bonesArea, ref MyFrameOption frameOption, ref bool useFirstPersonVersion) { var currentMovementState = GetCurrentMovementState(); if (DefinitionId.Value.SubtypeId == medievelMaleSubtypeId) { if (command.ExcludeLegsWhenMoving) { //In this case, we must stop all upper animations correctly if (currentMovementState == MyCharacterMovementEnum.RotatingLeft || currentMovementState == MyCharacterMovementEnum.RotatingRight || currentMovementState == MyCharacterMovementEnum.Standing) { bonesArea = TopBody + " LowerBody"; } else { bonesArea = TopBody; } frameOption = frameOption != MyFrameOption.JustFirstFrame ? MyFrameOption.PlayOnce : frameOption; } else if (m_lastBonesArea == TopBody + " LowerBody") { StopLowerCharacterAnimation(0.2f); } m_lastBonesArea = bonesArea; } else { if (currentMovementState != MyCharacterMovementEnum.Standing && currentMovementState != MyCharacterMovementEnum.RotatingLeft && currentMovementState != MyCharacterMovementEnum.RotatingRight && command.ExcludeLegsWhenMoving) { //In this case, we must stop all upper animations correctly bonesArea = TopBody; frameOption = frameOption != MyFrameOption.JustFirstFrame ? MyFrameOption.PlayOnce : frameOption; } } useFirstPersonVersion = IsInFirstPersonView; if (animDefinition.AllowWithWeapon) { if (!UseAnimationForWeapon) { StoreWeaponRelativeMatrix(); UseAnimationForWeapon = true; m_resetWeaponAnimationState = true; } } if (!animDefinition.LeftHandItem.TypeId.IsNull) { if (m_leftHandItem != null) { (m_leftHandItem as IMyHandheldGunObject <Sandbox.Game.Weapons.MyDeviceBase>).OnControlReleased(); m_leftHandItem.Close(); } m_leftHandItem = MyEntityFactory.CreateEntity(animDefinition.LeftHandItem.TypeId); var ob = MyEntityFactory.CreateObjectBuilder(m_leftHandItem); m_leftHandItem.Init(ob); var leftHandTool = m_leftHandItem as IMyHandheldGunObject <Sandbox.Game.Weapons.MyDeviceBase>; if (leftHandTool != null) { leftHandTool.OnControlAcquired(this); } (m_leftHandItem as IMyHandheldGunObject <Sandbox.Game.Weapons.MyDeviceBase>).OnControlAcquired(this); UpdateLeftHandItemPosition(); MyEntities.Add(m_leftHandItem); } }
internal void PlayerPlay(string playerName, MyAnimationDefinition animDefinition, bool firstPerson, MyFrameOption frameOption, float blendTime, float timeScale) { MyAnimationPlayerBlendPair player; if (TryGetAnimationPlayer(playerName, out player)) { player.Play(animDefinition, firstPerson, frameOption, blendTime, timeScale); } // else // Debug.Fail("Non existing animation set"); }
/// <summary> /// Virtual method called when animation is started, used in MyCharacter. /// </summary> protected virtual void OnAnimationPlay(MyAnimationDefinition animDefinition, MyAnimationCommand command, ref string bonesArea, ref MyFrameOption frameOption, ref bool useFirstPersonVersion) { }
protected bool TryGetAnimationDefinition(string animationSubtypeName, out MyAnimationDefinition animDefinition) { if (animationSubtypeName == null) { animDefinition = null; return false; } animDefinition = MyDefinitionManager.Static.TryGetAnimationDefinition(animationSubtypeName); if (animDefinition == null) { //Try backward compatibility //Backward compatibility string oldPath = System.IO.Path.Combine(MyFileSystem.ContentPath, animationSubtypeName); if (MyFileSystem.FileExists(oldPath)) { animDefinition = new MyAnimationDefinition() { AnimationModel = oldPath, ClipIndex = 0, }; return true; } animDefinition = null; return false; } return true; }