Update RealMode.cs
This commit is contained in:
@ -162,6 +162,24 @@ namespace DroneSimulator
|
||||
|
||||
public void Update(Vector3 value, uint time)
|
||||
{
|
||||
Vector3 v = value;
|
||||
|
||||
int noise = (int)(Noise * 1000);
|
||||
v.X += ((float)rand.Next(-noise, noise)) / 1000;
|
||||
v.Y += ((float)rand.Next(-noise, noise)) / 1000;
|
||||
v.Z += ((float)rand.Next(-noise, noise)) / 1000;
|
||||
|
||||
uint clock = (uint)(Lateness * 1000);
|
||||
|
||||
uint tick = time - last;
|
||||
last = time;
|
||||
while (tick != 0)
|
||||
{
|
||||
tick--;
|
||||
laten[index++] = v;
|
||||
if (index >= clock) index = 0;
|
||||
}
|
||||
|
||||
if (!Enable)
|
||||
{
|
||||
result = Vector3.NaN;
|
||||
@ -176,29 +194,12 @@ namespace DroneSimulator
|
||||
return;
|
||||
}
|
||||
|
||||
int noise = (int)(Noise * 1000);
|
||||
value.X += ((float)rand.Next(-noise, noise)) / 1000;
|
||||
value.Y += ((float)rand.Next(-noise, noise)) / 1000;
|
||||
value.Z += ((float)rand.Next(-noise, noise)) / 1000;
|
||||
|
||||
uint clock = (uint)(Lateness * 1000);
|
||||
|
||||
uint tick = time - last;
|
||||
last = time;
|
||||
while (tick != 0)
|
||||
{
|
||||
tick--;
|
||||
laten[index++] = value;
|
||||
if (index >= clock) index = 0;
|
||||
}
|
||||
|
||||
value = laten[index];
|
||||
v = laten[index];
|
||||
|
||||
uint freq = 1000 / Freq;
|
||||
|
||||
if (timer + freq <= time)
|
||||
{
|
||||
result = value;
|
||||
result = v;
|
||||
timer = time;
|
||||
}
|
||||
}
|
||||
@ -227,9 +228,24 @@ namespace DroneSimulator
|
||||
|
||||
public void Update(float value, uint time)
|
||||
{
|
||||
//value = Pressure - value * 12.15f;
|
||||
value = Pressure * MathF.Exp(-0.02896f * 9.81f * value / (8.314f * (Temperature + 273.15f)));
|
||||
|
||||
float v = value;
|
||||
|
||||
int noise = (int)(Noise * 1000);
|
||||
v += ((float)rand.Next(-noise, noise)) / 1000;
|
||||
|
||||
uint clock = (uint)(Lateness * 1000);
|
||||
|
||||
uint tick = time - last;
|
||||
last = time;
|
||||
while (tick != 0)
|
||||
{
|
||||
tick--;
|
||||
laten[index++] = v;
|
||||
if (index >= clock) index = 0;
|
||||
}
|
||||
|
||||
if (!Enable)
|
||||
{
|
||||
result = float.NaN;
|
||||
@ -241,30 +257,15 @@ namespace DroneSimulator
|
||||
{
|
||||
result = value;
|
||||
timer = time;
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
int noise = (int)(Noise * 1000);
|
||||
value += ((float)rand.Next(-noise, noise)) / 1000;
|
||||
|
||||
uint clock = (uint)(Lateness * 1000);
|
||||
|
||||
uint tick = time - last;
|
||||
last = time;
|
||||
while (tick != 0)
|
||||
{
|
||||
tick--;
|
||||
laten[index++] = value;
|
||||
if (index >= clock) index = 0;
|
||||
}
|
||||
|
||||
value = laten[index];
|
||||
v = laten[index];
|
||||
|
||||
uint freq = 1000 / Freq;
|
||||
|
||||
if (timer + freq <= time)
|
||||
{
|
||||
result = value;
|
||||
result = v;
|
||||
timer = time;
|
||||
}
|
||||
}
|
||||
@ -296,6 +297,27 @@ namespace DroneSimulator
|
||||
{
|
||||
value *= Lens;
|
||||
|
||||
Vector2 v = value;
|
||||
|
||||
if (Range > MaxHeight) v = Vector2.Zero;
|
||||
else
|
||||
{
|
||||
int noise = (int)(Noise * 1000);
|
||||
v.X += ((float)rand.Next(-noise, noise)) / 1000;
|
||||
v.Y += ((float)rand.Next(-noise, noise)) / 1000;
|
||||
}
|
||||
|
||||
uint clock = (uint)(Lateness * 1000);
|
||||
|
||||
uint tick = time - last;
|
||||
last = time;
|
||||
while (tick != 0)
|
||||
{
|
||||
tick--;
|
||||
laten[index++] = v;
|
||||
if (index >= clock) index = 0;
|
||||
}
|
||||
|
||||
if (!Enable)
|
||||
{
|
||||
result = Vector2.NaN;
|
||||
@ -310,32 +332,12 @@ namespace DroneSimulator
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Range > MaxHeight) value = Vector2.Zero;
|
||||
else
|
||||
{
|
||||
int noise = (int)(Noise * 1000);
|
||||
value.X += ((float)rand.Next(-noise, noise)) / 1000;
|
||||
value.Y += ((float)rand.Next(-noise, noise)) / 1000;
|
||||
}
|
||||
|
||||
uint clock = (uint)(Lateness * 1000);
|
||||
|
||||
uint tick = time - last;
|
||||
last = time;
|
||||
while (tick != 0)
|
||||
{
|
||||
tick--;
|
||||
laten[index++] = value;
|
||||
if (index >= clock) index = 0;
|
||||
}
|
||||
|
||||
value = laten[index];
|
||||
v = laten[index];
|
||||
|
||||
uint freq = 1000 / Freq;
|
||||
|
||||
if (timer + freq <= time)
|
||||
{
|
||||
result = value;
|
||||
result = v;
|
||||
timer = time;
|
||||
return true;
|
||||
}
|
||||
@ -366,6 +368,26 @@ namespace DroneSimulator
|
||||
|
||||
public void Update(float value, uint time)
|
||||
{
|
||||
float v = value;
|
||||
|
||||
if (v > MaxHeight) v = -1;
|
||||
else
|
||||
{
|
||||
int noise = (int)(Noise * 1000);
|
||||
v += ((float)rand.Next(-noise, noise)) / 1000;
|
||||
}
|
||||
|
||||
uint clock = (uint)(Lateness * 1000);
|
||||
|
||||
uint tick = time - last;
|
||||
last = time;
|
||||
while (tick != 0)
|
||||
{
|
||||
tick--;
|
||||
laten[index++] = v;
|
||||
if (index >= clock) index = 0;
|
||||
}
|
||||
|
||||
if (!Enable)
|
||||
{
|
||||
result = float.NaN;
|
||||
@ -380,31 +402,12 @@ namespace DroneSimulator
|
||||
return;
|
||||
}
|
||||
|
||||
if (value > MaxHeight) value = -1;
|
||||
else
|
||||
{
|
||||
int noise = (int)(Noise * 1000);
|
||||
value += ((float)rand.Next(-noise, noise)) / 1000;
|
||||
}
|
||||
|
||||
uint clock = (uint)(Lateness * 1000);
|
||||
|
||||
uint tick = time - last;
|
||||
last = time;
|
||||
while (tick != 0)
|
||||
{
|
||||
tick--;
|
||||
laten[index++] = value;
|
||||
if (index >= clock) index = 0;
|
||||
}
|
||||
|
||||
value = laten[index];
|
||||
v = laten[index];
|
||||
|
||||
uint freq = 1000 / Freq;
|
||||
|
||||
if (timer + freq <= time)
|
||||
{
|
||||
result = value;
|
||||
result = v;
|
||||
timer = time;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user