public M2SceneNode SetMainM2SceneNode(string filename, bool npc) { RemoveMainSceneNode(); M2SceneNode node = Engine.Instance.SceneManager.AddM2SceneNode(filename, null, npc); if (node != null) { switch (node.Type) { case M2Type.MT_INTERFACE: { node.ResetState(); node.PlayAnimation("Stand", 0, true, 0); node.SetCamera(0); } break; default: { matrix4 mat = new matrix4(true); mat.RotationDegrees = new vector3df(0, 90, 0); node.SetRelativeTransformation(ref mat); node.ResetState(); node.PlayAnimation("Stand", 0, true, 0); } break; } } Engine.Instance.SceneManager.SetDebugM2SceneNode(node); mainM2SceneNode = node; RaiseMainM2SceneNodeChanged(); return(node); }
private void playExecuted(object sender, ExecutedRoutedEventArgs e) { M2SceneNode node = ModelSceneService.Instance.MainM2SceneNode; AnimationContent content = ShellService.Instance.AnimationContent; int animIndex = content.GetCurrentAnimaitonIndex(); if (node == null || animIndex == -1) { return; } if (animIndex != node.AnimationPlayer.CurrentAnimationIndex || node.AnimationPlayer.Loop != content._animationSelect._animationToolbar.Loop) { node.ResetState(); node.AnimationPlayer.Loop = content._animationSelect._animationToolbar.Loop; node.PlayAnimation((uint)animIndex, node.AnimationPlayer.Loop, 200); } node.AnimationPlayer.Resume(); }