Polished, began adding score, added warning to download.

This commit is contained in:
2020-07-11 18:43:47 -05:00
parent fd8317c613
commit dce1c03ba9
10 changed files with 131 additions and 43 deletions

View File

@@ -14,7 +14,7 @@ namespace SkinnerBox.Entities
public TransitionValue progressValue;
public RectangleMesh progressMesh;
public TransitionValue timeElapsed;
public float health;
public float upTime;
int size;
public int Size {
get {
@@ -30,7 +30,7 @@ namespace SkinnerBox.Entities
public override RectangleF HitBox {
get {
RectangleF rect = base.HitBox;
rect.Width = Width * size;
rect.Width = Width + 0.5f;
return rect;
}
}
@@ -53,15 +53,11 @@ namespace SkinnerBox.Entities
public void Reset()
{
Size = 1;
X = 0;
Y = 0;
mesh.X = X;
mesh.Y = Y;
progressValue.HardSet(0);
timeElapsed.HardSet(0);
stepSize = 0;
health = 0;
Color = Color.DarkCyan;
upTime = 0;
Color = Color.Cyan;
UpdateProgressMesh();
}
@@ -75,11 +71,13 @@ namespace SkinnerBox.Entities
public override void InterpolatePosition(float delta) {
progressValue.InterpolatePosition(delta);
timeElapsed.InterpolatePosition(delta);
float prog = timeElapsed.Value / health;
float prog = timeElapsed.Value / upTime;
if (prog > 1) prog = 1;
if (prog < 0) prog = 0;
this.Color = Color.FromArgb((int)(byte.MaxValue * (1f - prog)), Color);
progressMesh.Color = Color.FromArgb((int)(byte.MaxValue * (1f - prog)), progressMesh.Color);
UpdateProgressMesh();
base.InterpolatePosition(delta);
}
}
@@ -87,7 +85,7 @@ namespace SkinnerBox.Entities
{
public float period;
public float elapsedSinceSpawn;
public float health;
public float upTime;
public float stepSize;
public int maximumAmount;
public int generalSize;
@@ -97,7 +95,7 @@ namespace SkinnerBox.Entities
{
this.period = cooldown;
this.elapsedSinceSpawn = 0;
this.health = health;
this.upTime = health;
this.stepSize = stepSize;
this.maximumAmount = maxAmount;
this.sizeRange = sizeRange;

View File

@@ -7,6 +7,8 @@ namespace SkinnerBox.Entities
{
public class ServerEntity : Entity
{
public const float MIN_SPEED = 1f;
public const float SPEED_STEP = 1f;
private readonly float length = 4/8f;
public float Speed { get; set; }
public override float CenterX {
@@ -35,7 +37,7 @@ namespace SkinnerBox.Entities
public override RectangleF HitBox {
get {
RectangleF hitbox = base.HitBox;
hitbox.Width = hitbox.Width * size;
hitbox.Width = Width;
return hitbox;
}
}
@@ -46,7 +48,7 @@ namespace SkinnerBox.Entities
Size = 1;
this.Speed = 2f;
this.Speed = MIN_SPEED;
CenterX = initialX;
mesh.X = X;

View File

@@ -12,8 +12,8 @@ namespace SkinnerBox.Entities
public TransitionValue aliveTime;
public WarningEntity(ITexture texture) : base(texture) {
this.Width = 2;
this.Height = 2;
this.Width = 1f;
this.Height = 1f;
Reset();
}
public void Reset()
@@ -21,7 +21,7 @@ namespace SkinnerBox.Entities
LifeTime = 0;
X = 0 - Width;
mesh.X = X;
Y = Game.HEIGHT_UNITS - Height;
Y = - Height;
mesh.Y = Y;
aliveTime.HardSet(0);
this.Color = Color.Red;