コード例 #1
0
        public void UpdateGame()
        {
            UpdateBombs();
            UpdateCurrentMapData();
            myPlayer.Update();
            otherPlayer.Update();
            debugBoxes.Clear();
            CheckPlayerCollision(myPlayer);
            CheckPlayerCollision(otherPlayer);

            packetSendDelay--;
            if (packetSendDelay == 0)
            {
                packetSendDelay = 5;
                PacketData.PlayerPacketData playerPacketData = new PacketData.PlayerPacketData();
                playerPacketData.direction = (int)myPlayer.GetDirection();
                playerPacketData.moveSpeed = myPlayer.GetMoveSpeed();
                playerPacketData.moving    = myPlayer.GetMoving();
                playerPacketData.positionX = myPlayer.GetPosition().X;
                playerPacketData.positionY = myPlayer.GetPosition().Y;
                PacketData.BombermanClientToServerPacket packet = new PacketData.BombermanClientToServerPacket(bombsSinceLastPacket, playerPacketData);
                client.TCPSendPacket(packet);
                bombsSinceLastPacket.Clear();
            }
        }
コード例 #2
0
 public void UpdateOtherPlayerWithPacket(PacketData.PlayerPacketData playerPacketData)
 {
     otherPlayer.SetPositionX(playerPacketData.positionX);
     otherPlayer.SetPositionY(playerPacketData.positionY);
     otherPlayer.SetMoveSpeed(playerPacketData.moveSpeed);
     otherPlayer.SetMoving(playerPacketData.moving);
     otherPlayer.SetDirection((PlayerDirection)playerPacketData.direction);
 }