void PlayerInput_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Space)
     {
         PressJump = true;
         Jump();
     }
     else if (e.KeyCode == Keys.T && e.Modifiers == Keys.Control)
     {
         NCamera      camera   = Program.game.GameWindow.ViewportControl.Viewport.Camera;
         Ray          mouseRay = camera.GetMouseRay(PlayerInput.MouseValueX, PlayerInput.MouseValueY);
         NCheckResult hit      = new NCheckResult();
         if (GameEngine.EngineInstance.CurrentLevel.LineCheck(out hit, mouseRay.Position, mouseRay.Position + mouseRay.Direction * camera.ZFar, LineCheckType.World))
         {
             this.Transport(GameEngine.EngineInstance.GameLevel, hit.location, true);
         }
     }
     else if (e.KeyCode == Keys.D1)
     {
         // todo: 测试释放技能
         ClientUseSkill(1909162191);
     }
     else if (e.KeyCode == Keys.D2)
     {
         ClientUseSkill(4020073455);
     }
     else if (e.KeyCode == Keys.D3)
     {
         ClientUseSkill(1525076748);
     }
     else if (e.KeyCode == Keys.D4)
     {
         ClientUseSkill(3299876908);
     }
 }
        public void ClientUseSkill(UInt32 spellId)
        {
            NCamera      camera   = Program.game.GameWindow.ViewportControl.Viewport.Camera;
            Ray          mouseRay = camera.GetMouseRay(PlayerInput.MouseValueX, PlayerInput.MouseValueY);
            NCheckResult hit      = new NCheckResult();

            if (GameEngine.EngineInstance.CurrentLevel.LineCheck(out hit, mouseRay.Position, mouseRay.Position + mouseRay.Direction * camera.ZFar, LineCheckType.World))
            {
                C2S_CastSpell msg;
                msg.MessageId = C2S_CastSpell.Id;
                msg.SpellID   = spellId;
                msg.TargetId  = 0;
                msg.TargetPos = hit.location;
                msg.TimeStamp = NativeEngineHelper.GetTimeSeconds();
                msg.CastCount = 1;
                GameFrameManager.SendNetMessage <C2S_CastSpell>(msg);
            }
        }
        /// <summary>
        /// 鼠标移动
        /// </summary>
        private void MouseMove(NCamera camera)
        {
            // 取鼠标射线点击Level中的Hit点
            if ((PlayerInput.ClickLocationX != 0 || PlayerInput.ClickLocationY != 0) && PlayerInput.IsKeyPressed(Keys.LButton))
            {
                Ray          mouseRay = camera.GetMouseRay(PlayerInput.ClickLocationX, PlayerInput.ClickLocationY);
                NCheckResult hit      = new NCheckResult();
                if (GameEngine.EngineInstance.CurrentLevel.LineCheck(out hit, mouseRay.Position, mouseRay.Position + mouseRay.Direction * camera.ZFar, LineCheckType.World))
                {
                    MoveTargetLocation = new Vector3(hit.location.x,
                                                     GameEngine.EngineInstance.CurrentLevel.GetWorldHeight(MoveTargetLocation.x, MoveTargetLocation.z),
                                                     hit.location.z);
                    moveTargetDirect = Vector3.Normalize(MoveTargetLocation - this.TargetActor.Location);
                    reachTarget      = false;
                }
            }

#if DEBUG
            GameViewportControl.debugInfos.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture,
                                                             "MoveTargetLocation: {0}\r\n", MoveTargetLocation.ToString()));
#endif

            if (!reachTarget)
            {
                // 朝向目标移动
                Vector3 dir = Vector3.Normalize(MoveTargetLocation - this.TargetActor.Location);
                if (ReachedDestination(this.TargetActor.Location, MoveTargetLocation) ||
                    Vector3.Dot(moveTargetDirect, dir) < 0)
                {
                    this.Acceleration = Vector3.Zero;
                    reachTarget       = true;
                }
                else
                {
                    this.Acceleration = dir;
                }
            }
        }
        /// <summary>
        /// 鼠标移动
        /// </summary>
        private void MouseMove(GamePlayerInput playerInput, NCamera camera, GameEngine engine)
        {
            // 取鼠标射线点击Level中的Hit点
            if (playerInput.ClickLocationX != 0 || playerInput.ClickLocationY != 0)
            {
                Ray          mouseRay = camera.GetMouseRay(playerInput.ClickLocationX, playerInput.ClickLocationY);
                NCheckResult hit      = new NCheckResult();
                if (engine.CurrentLevel.LineCheck(out hit, mouseRay.Position, mouseRay.Position + mouseRay.Direction * camera.ZFar, LineCheckType.World))
                {
                    MoveTargetLocation = hit.location;
                    moveTargetDirect   = Vector3.Normalize(MoveTargetLocation - this.TargetActor.Location);
                    reachTarget        = false;
                }
            }

#if DEBUG
            GameViewportControl.debugInfos.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture,
                                                             "MoveTargetLocation: {0}\r\n", MoveTargetLocation.ToString()));
#endif

            if (!reachTarget)
            {
                // 朝向目标移动
                Vector3 dir = Vector3.Normalize(MoveTargetLocation - this.TargetActor.Location);
                if (ReachedDestination(this.TargetActor.Location, MoveTargetLocation) ||
                    Vector3.Dot(moveTargetDirect, dir) < 0)
                {
                    this.Acceleration = Vector3.Zero;
                    //this.Velocity = Vector3.Zero;
                    reachTarget = true;
                }
                else
                {
                    this.Acceleration = dir;
                }
            }
        }