public double checkGate(bool vert) // тут проверяем высоту и крен в воротах
{
double res = 0;
if (playerPlane != null)
{
double h = (playerPlane.Pos().z + prevH)/2;
double roll = (playerPlane.getParameter(part.ParameterTypes.Z_Orientation, 2) + prevRoll)/2;
gatesList[nextGate].h = h;
gatesList[nextGate].roll = roll;
if (h > hPenaltyLimit)
{
penaltyTotal += penaltyH;
res += penaltyH;
}
if (vert)
{
if ((Math.Abs(roll) < (90 - rollPenaltyLimit)) || (Math.Abs(roll) > (90 + rollPenaltyLimit)))
{
penaltyTotal += penaltyRoll;
res += penaltyRoll;
}
}
else
{
if ((Math.Abs(roll) > (+rollPenaltyLimit)))
{
penaltyTotal += penaltyRoll;
res += penaltyRoll;
}
}
GamePlay.gpLogServer(null, "Height :{0}, roll:{1}, penalty:{2}", new object[] { h.ToString("f1"), roll.ToString("f1"), penaltyTotal });
}
return res;
}