예제 #1
0
        public M2SceneNode SetMainM2SceneNode(string filename, bool npc)
        {
            if (Client.Instance.GetPlayer().GetRideNpcId() != 0)
            {
                Client.Instance.GetPlayer().RideOnModel(0, E_M2_STATES.EMS_STAND);
            }

            RemoveMainSceneNode();

            M2SceneNode node = Engine.Instance.SceneManager.AddM2SceneNode(filename, null, npc);

            if (node != null)
            {
                switch (node.Type)
                {
                case M2Type.MT_INTERFACE:
                {
                    if (node.M2Fsm != null)
                    {
                        node.M2Fsm.ResetState();
                    }
                    node.PlayAnimation("Stand", 0, true, 0);
                    node.SetCamera(0);
                }
                break;

                default:
                {
                    M2Move move = node.M2Move;
                    if (move != null)
                    {
                        move.Dir = new vector3df(0, 0, -1);
                    }
                    else
                    {
                        matrix4 mat = new matrix4(true);
                        mat.RotationDegrees = new vector3df(0, 90, 0);
                        node.SetRelativeTransformation(ref mat);
                    }

                    if (node.M2Fsm != null)
                    {
                        node.M2Fsm.ResetState();
                    }
                    node.PlayAnimation("Stand", 0, true, 0);
                }
                break;
                }
            }

            Engine.Instance.SceneManager.SetDebugM2SceneNode(node);

            mainM2SceneNode = node;

            RaiseMainM2SceneNodeChanged();

            return(node);
        }
예제 #2
0
        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 || Client.Instance.GetPlayer().GetRideNpcId() != 0)
            {
                return;
            }

            if (animIndex != node.AnimationPlayer.CurrentAnimationIndex ||
                node.AnimationPlayer.Loop != content._animationSelect._animationToolbar.Loop)
            {
                if (node.M2Fsm != null)
                {
                    node.M2Fsm.ResetState();
                }

                node.AnimationPlayer.Loop = content._animationSelect._animationToolbar.Loop;

                node.PlayAnimation((uint)animIndex, node.AnimationPlayer.Loop, 200);
            }

            node.AnimationPlayer.Resume();
        }
        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);
        }