當前位置: 首頁>>代碼示例>>C#>>正文


C# BaseGame.SendPlayerMove方法代碼示例

本文整理匯總了C#中BaseGame.SendPlayerMove方法的典型用法代碼示例。如果您正苦於以下問題:C# BaseGame.SendPlayerMove方法的具體用法?C# BaseGame.SendPlayerMove怎麽用?C# BaseGame.SendPlayerMove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BaseGame的用法示例。


在下文中一共展示了BaseGame.SendPlayerMove方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: HandleCommand

        public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
        {
            if (player.IsAttacking)
            {
                //GSPacketIn pkg = packet.Clone();
                //pkg.ClientID = player.PlayerDetail.PlayerCharacter.ID;
                //pkg.Parameter1 = player.Id;
                //game.SendToAll(pkg, player.PlayerDetail);

                byte type = packet.ReadByte();
                int tx = packet.ReadInt();
                int ty = packet.ReadInt();
                byte dir = packet.ReadByte();
                bool isLiving = packet.ReadBoolean();
                //_loc_7.writeShort(param6); _player.map.currentTurn
                short map_currentTurn = packet.ReadShort();
                game.SendPlayerMove(player, type, tx, ty, dir, isLiving);
                switch (type)
                {
                    case 0:
                    case 1:

                        player.SetXY(tx, ty);
                        player.StartMoving();
                        if (player.Y - ty > 1 || player.IsLiving != isLiving)
                        {
                            //trminhpc type=3
                            game.SendPlayerMove(player, 3, player.X, player.Y, 0);//, player.IsLiving, null);
                        }
                        //else
                        //{
                        //    game.SendPlayerMove(player, type, tx, ty, dir, isLiving, null);
                        //}
                        break;

                }
            }
        }
開發者ID:vancourt,項目名稱:BaseGunnyII,代碼行數:38,代碼來源:MoveStartCommand.cs

示例2: ExecuteImp

        protected override void ExecuteImp(BaseGame game, long tick)
        {
            if (!m_isSend)
            {
                m_isSend = true;

                game.SendPlayerMove(m_player, 2, m_target.X, m_target.Y, (byte)(m_v.X > 0 ? 1 : -1), false);//, null);
            }

            if (m_target.Distance(m_player.X, m_player.Y) > 2)
            {
                m_player.SetXY(m_player.X + m_v.X, m_player.Y + m_v.Y);
            }
            else
            {
                m_player.SetXY(m_target.X, m_target.Y);
                Finish(tick);
            }
        }
開發者ID:vancourt,項目名稱:BaseGunnyII,代碼行數:19,代碼來源:GhostMoveAction.cs

示例3: HandleCommand

        public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
        {
            if (player.IsAttacking)
            {
                GSPacketIn pkg = packet.Clone();
                pkg.ClientID = player.PlayerDetail.PlayerCharacter.ID;
                pkg.Parameter1 = player.Id;
                game.SendToAll(pkg, player.PlayerDetail);

                byte type = packet.ReadByte();
                int tx = packet.ReadInt();
                int ty = packet.ReadInt();
                byte dir = packet.ReadByte();
                bool isLiving = packet.ReadBoolean();
                //Console.WriteLine("isLiving : {0}, tx : {1}, ty : {2}, type : {3}, playerId : {4}", isLiving, tx, ty, type, player.Id);
                switch (type)
                {
                    case 0:
                    case 1:
                        //p.X = tx;
                        //p.Y = ty;
                       // if (player.PlayerDetail.PlayerCharacter.NickName == "jacken123")
                           // Console.WriteLine(player.PlayerDetail.PlayerCharacter.NickName + "X坐標" + player.X.ToString() + "Y坐標" + player.Y.ToString());
                        player.SetXY(tx, ty);
                        player.StartMoving();
                       // if (player.PlayerDetail.PlayerCharacter.NickName == "jacken123")
                           // Console.WriteLine(string.Format("修正掉落: 動作類型  {0}    原始Y:{1}     最新Y:{2}", type, ty, player.Y));
                        if (player.Y - ty > 1 || player.IsLiving != isLiving)
                        {
                            //Console.WriteLine("player.IsLiving : {0}, playerId : {1}", player.IsLiving, player.Id);
                            //把服務器修正的掉落指令和客戶掉落指令加以區分。
                            Console.WriteLine("玩家移動掉落:"+player.IsLiving.ToString());
                            game.SendPlayerMove(player, 3, player.X, player.Y, 0, player.IsLiving, null);
                        }
                        break;
                    case 2:
                        break;
                }
            }
        }
開發者ID:geniushuai,項目名稱:DDTank-3.0,代碼行數:40,代碼來源:MoveStartCommand.cs


注:本文中的BaseGame.SendPlayerMove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。