예제 #1
0
    private void SendInput()
    {
        var angles = GetRotation();
        var move   = GetMove();
        var shoot  = GetShot();

        _prediction.AddInputs(_sequence, (int)move.x, (int)move.y, (int)angles.y);
        BitBuffer bitBuffer = new BitBuffer();

        //TODO: cambiar rango de player id
        bitBuffer.InsertInt(_engine.playerId, 0, 10);

        bitBuffer.InsertInt((int)angles.x, 0, 360);
        bitBuffer.InsertInt((int)angles.y, 0, 360);
        bitBuffer.InsertInt((int)angles.z, 0, 360);

        bitBuffer.InsertInt((int)move.x, -1, 1);
        bitBuffer.InsertInt((int)move.y, -1, 1);

        bitBuffer.InsertBit(shoot);

        _packetProcessor.SendReliableFastData(bitBuffer.GetByteArray(), _serverIpEndPoint, MessageType.Input, _sequence);
    }