예제 #1
0
 public static void Gauge(this IMetrics metrics, string name, f32_wheel wheel, float scale = 1)
 {
     metrics.Gauge($"wheels.front_left.{name}", wheel.FrontLeft * scale);
     metrics.Gauge($"wheels.front_right.{name}", wheel.FrontRight * scale);
     metrics.Gauge($"wheels.rear_left.{name}", wheel.RearLeft * scale);
     metrics.Gauge($"wheels.rear_right.{name}", wheel.RearRight * scale);
 }
        public ForzaPacket(byte[] data)
        {
            var read = new Parser(data);

            isRaceOn         = read.s32();
            timeStampMS      = read.u32();
            engineMaxRpm     = read.f32();
            engineIdleRpm    = read.f32();
            currentEngineRpm = read.f32();
            acceleration     = read.f32_Vec();
            velocity         = read.f32_Vec();
            angularVelocity  = read.f32_Vec();
            pitch            = read.f32();
            yaw  = read.f32();
            roll = read.f32();
            normalizedSuspensionTravel = read.f32_Wheel();
            tireSlipRatio          = read.f32_Wheel();
            wheelRotationSpeed     = read.f32_Wheel();
            wheelOnRumbleStrip     = read.f32_Wheel();
            wheelInPuddleDepth     = read.f32_Wheel();
            surfaceRumble          = read.f32_Wheel();
            tireSlipAngle          = read.f32_Wheel();
            tireCombinedSlip       = read.f32_Wheel();
            suspensionTravelMeters = read.f32_Wheel();
            carOrdinal             = read.s32();
            carClass           = read.s32();
            carPerfomanceIndex = read.s32();
            driveTrainType     = read.s32();
            numCylinders       = read.s32();

            hasDashData = data.Length >= 232;
            //
            if (data.Length >= 324)
            {
                b1 = read.u8();
                b2 = read.u8();
                b3 = read.u8();
                b4 = read.u8();
                b5 = read.u8();
                b6 = read.u8();
                b7 = read.u8();
                b8 = read.u8();
                b9 = read.u8();
                ba = read.u8();
                bb = read.u8();
                bc = read.u8();
            }
            if (hasDashData)
            {
                // Dash data
                position                    = read.f32_Vec();
                speed                       = read.f32();
                power                       = read.f32();
                torque                      = read.f32();
                tireTemp                    = read.f32_Wheel();
                boost                       = read.f32();
                fuel                        = read.f32();
                distanceTraveled            = read.f32();
                bestLap                     = read.f32();
                lastLap                     = read.f32();
                currentLap                  = read.f32();
                currentRaceTime             = read.f32();
                lapNumber                   = read.u16();
                racePosition                = read.u8();
                accel                       = read.u8();
                brake                       = read.u8();
                clutch                      = read.u8();
                handBrake                   = read.u8();
                gear                        = read.u8();
                steer                       = read.u8();
                normalizedDrivingLine       = read.s8();
                normalizedAIBrakeDifference = read.s8();
            }
            if (data.Length >= 324)
            {
                last = read.s8();
            }
        }