Added DDOS entity. Tuned values. Game Over now restarts.

This commit is contained in:
2020-07-12 03:33:09 -05:00
parent 0139832d19
commit 0633e7880f
6 changed files with 152 additions and 25 deletions

52
Entities/DDOSEntity.cs Normal file
View File

@@ -0,0 +1,52 @@
using SlatedGameToolkit.Framework.Graphics.Textures;
using SlatedGameToolkit.Framework.Utilities.Collections.Pooling;
using System.Drawing;
namespace SkinnerBox.Entities
{
public class DDOSEntity : Entity, IPoolable
{
private float speed;
public DDOSEntity(ITexture texture) : base(texture)
{
Width = 0.5f;
this.Color = Color.Red;
}
public void Initialize(float xPos, float length, float speed, float delay)
{
Height = length;
X = xPos;
this.mesh.X = X;
this.speed = speed;
this.Y += delay * speed;
mesh.Y = Y;
}
public void Update(float delta) {
Y -= speed * delta;
}
public void Reset()
{
Height = 0;
Y = Game.HEIGHT_UNITS;
mesh.Y = Y;
speed = 0;
}
}
public struct DDOSSPawnInfo
{
public float speed;
public float interval;
public float intervalDeviation;
public float timeRemaining;
public DDOSSPawnInfo(float speed, float interval, float intervalDeviation, float timeRemaining)
{
this.speed = speed;
this.interval = interval;
this.intervalDeviation = intervalDeviation;
this.timeRemaining = timeRemaining;
}
}
}

View File

@@ -9,7 +9,7 @@ namespace SkinnerBox.Entities
public class DownloadEntity : Entity, IPoolable
{
private readonly float unitSize = 1/2f;
private readonly float unitPerProgressTexture = 0.5f;
private readonly float unitPerProgressTexture = 0.4f;
public float stepSize;
public TransitionValue progressValue;
public RectangleMesh progressMesh;
@@ -53,7 +53,7 @@ namespace SkinnerBox.Entities
public void Reset()
{
Size = 1;
progressValue.HardSet(0);
progressValue.HardSet(0.1f);
timeElapsed.HardSet(0);
stepSize = 0;
upTime = 0;