Value changes.
This commit is contained in:
parent
0633e7880f
commit
1126e6c4b4
@ -70,7 +70,7 @@ namespace SkinnerBox.States
|
|||||||
private int packetsReceived;
|
private int packetsReceived;
|
||||||
private int totalPackets;
|
private int totalPackets;
|
||||||
private readonly float totalStability = 5;
|
private readonly float totalStability = 5;
|
||||||
private float stability;
|
private float health;
|
||||||
private RectangleMesh stabilityMesh;
|
private RectangleMesh stabilityMesh;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ namespace SkinnerBox.States
|
|||||||
server.Speed = 4;
|
server.Speed = 4;
|
||||||
bandwithBoost = 0;
|
bandwithBoost = 0;
|
||||||
speedBoost = 3;
|
speedBoost = 3;
|
||||||
stability = totalStability;
|
health = totalStability;
|
||||||
packetsReceived = 0;
|
packetsReceived = 0;
|
||||||
totalPackets = 0;
|
totalPackets = 0;
|
||||||
downloadsServed = 0;
|
downloadsServed = 0;
|
||||||
@ -113,6 +113,11 @@ namespace SkinnerBox.States
|
|||||||
|
|
||||||
this.font.PixelHeight = 32;
|
this.font.PixelHeight = 32;
|
||||||
font.PrepareCharacterGroup("Score:0123456789Uptim.%".ToCharArray());
|
font.PrepareCharacterGroup("Score:0123456789Uptim.%".ToCharArray());
|
||||||
|
|
||||||
|
activePackets.Clear();
|
||||||
|
activeWarnings.Clear();
|
||||||
|
activeDownloads.Clear();
|
||||||
|
activeDDOS.Clear();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,7 +201,7 @@ namespace SkinnerBox.States
|
|||||||
renderer.Draw(speedMesh);
|
renderer.Draw(speedMesh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float normalizedHealth = stability / totalStability;
|
float normalizedHealth = health / totalStability;
|
||||||
int red = (int) (byte.MaxValue * normalizedHealth);
|
int red = (int) (byte.MaxValue * normalizedHealth);
|
||||||
stabilityMesh.Color = Color.FromArgb(red, 0, 0);
|
stabilityMesh.Color = Color.FromArgb(red, 0, 0);
|
||||||
renderer.Draw(stabilityMesh);
|
renderer.Draw(stabilityMesh);
|
||||||
@ -268,7 +273,7 @@ namespace SkinnerBox.States
|
|||||||
packet.Color = Color.Cyan;
|
packet.Color = Color.Cyan;
|
||||||
}
|
}
|
||||||
if (packet.Y <= 0 - packet.Height) {
|
if (packet.Y <= 0 - packet.Height) {
|
||||||
stability -= 0.5f;
|
health -= 0.25f;
|
||||||
packetPool.Release(packet);
|
packetPool.Release(packet);
|
||||||
activePackets.RemoveAt(i);
|
activePackets.RemoveAt(i);
|
||||||
i--;
|
i--;
|
||||||
@ -277,7 +282,7 @@ namespace SkinnerBox.States
|
|||||||
if (packet.Y >= Game.HEIGHT_UNITS && packet.velocity < 0) {
|
if (packet.Y >= Game.HEIGHT_UNITS && packet.velocity < 0) {
|
||||||
score += -2 * packet.velocity;
|
score += -2 * packet.velocity;
|
||||||
packetsReceived++;
|
packetsReceived++;
|
||||||
stability += 0.025f;
|
health += 0.025f;
|
||||||
packetPool.Release(packet);
|
packetPool.Release(packet);
|
||||||
activePackets.RemoveAt(i);
|
activePackets.RemoveAt(i);
|
||||||
i--;
|
i--;
|
||||||
@ -334,7 +339,7 @@ namespace SkinnerBox.States
|
|||||||
}
|
}
|
||||||
if (download.timeElapsed.Value >= download.upTime)
|
if (download.timeElapsed.Value >= download.upTime)
|
||||||
{
|
{
|
||||||
stability -= 1.5f;
|
health -= 1.5f;
|
||||||
downloadPool.Release(download);
|
downloadPool.Release(download);
|
||||||
activeDownloads.RemoveAt(i);
|
activeDownloads.RemoveAt(i);
|
||||||
i--;
|
i--;
|
||||||
@ -366,7 +371,7 @@ namespace SkinnerBox.States
|
|||||||
DDOSEntity ddos = activeDDOS[i];
|
DDOSEntity ddos = activeDDOS[i];
|
||||||
ddos.Update((float)timeStep);
|
ddos.Update((float)timeStep);
|
||||||
if (ddos.HitBox.IntersectsWith(server.HitBox)) {
|
if (ddos.HitBox.IntersectsWith(server.HitBox)) {
|
||||||
stability -= (float) (10f * timeStep);
|
health -= (float) (10f * timeStep);
|
||||||
}
|
}
|
||||||
for (int p = 0; p < activePackets.Count; p++)
|
for (int p = 0; p < activePackets.Count; p++)
|
||||||
{
|
{
|
||||||
@ -403,7 +408,7 @@ namespace SkinnerBox.States
|
|||||||
packetSpawnInfo.perSpawn = (int)(0.5f * (Math.Pow(timeElapsed.Value, 0.5f) + 1));
|
packetSpawnInfo.perSpawn = (int)(0.5f * (Math.Pow(timeElapsed.Value, 0.5f) + 1));
|
||||||
packetSpawnInfo.speed = (float)((0.025f * Math.Pow(timeElapsed.Value, 1.1f)) + 1f);
|
packetSpawnInfo.speed = (float)((0.025f * Math.Pow(timeElapsed.Value, 1.1f)) + 1f);
|
||||||
if (packetSpawnInfo.jumpDistance < 2f) {
|
if (packetSpawnInfo.jumpDistance < 2f) {
|
||||||
packetSpawnInfo.jumpDistance = (float)(0.0018f * (Math.Pow(timeElapsed.Value, 1.1f)) + 0.75f);
|
packetSpawnInfo.jumpDistance = (float)(0.0023f * (Math.Pow(timeElapsed.Value, 1.15f)) + 0.75f);
|
||||||
if (packetSpawnInfo.jumpDistance > 2f) packetSpawnInfo.jumpDistance = 2f;
|
if (packetSpawnInfo.jumpDistance > 2f) packetSpawnInfo.jumpDistance = 2f;
|
||||||
}
|
}
|
||||||
if (packetSpawnInfo.interval > 0f) {
|
if (packetSpawnInfo.interval > 0f) {
|
||||||
@ -427,11 +432,11 @@ namespace SkinnerBox.States
|
|||||||
//ddos curve
|
//ddos curve
|
||||||
#endregion
|
#endregion
|
||||||
#region BoundaryChecking
|
#region BoundaryChecking
|
||||||
if (stability > totalStability) {
|
if (health > totalStability) {
|
||||||
stability = totalStability;
|
health = totalStability;
|
||||||
} else if (stability <= 0)
|
} else if (health <= 0)
|
||||||
{
|
{
|
||||||
stability = 0;
|
health = 0;
|
||||||
gameOverState.SetStats((int)Math.Round(this.score), this.timeElapsed.Value, downloadsServed, totalDownloads, packetsReceived, totalPackets);
|
gameOverState.SetStats((int)Math.Round(this.score), this.timeElapsed.Value, downloadsServed, totalDownloads, packetsReceived, totalPackets);
|
||||||
stateManager.ChangeState("GameOver");
|
stateManager.ChangeState("GameOver");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user