gmtk-gj-2020/Entities/PacketEntity.cs

56 lines
1.6 KiB
C#
Raw Normal View History

using System;
2020-07-12 17:05:52 +00:00
using System.Drawing;
using SlatedGameToolkit.Framework.Graphics.Render;
using SlatedGameToolkit.Framework.Graphics.Textures;
using SlatedGameToolkit.Framework.Utilities.Collections.Pooling;
namespace WebsiteSim.Entities
{
public class PacketEntity : Entity, IPositionInterpolable, IPoolable
{
public float velocity;
public PacketEntity(ITexture texture) : base(texture)
{
this.Width = 0.5f;
this.Height = 1f;
Reset();
}
public void Reset()
{
this.Y = Game.HEIGHT_UNITS;
this.mesh.Y = this.Y;
this.velocity = 0;
this.X = 0;
this.mesh.X = this.X;
2020-07-12 17:05:52 +00:00
Color = Color.Black;
}
public void Update(double delta) {
this.Y -= (float)(velocity * delta);
}
2020-07-11 22:09:33 +00:00
}
public struct PacketSpawnInfo
{
public float timeElapsed;
public float interval;
2020-07-11 22:09:33 +00:00
public int perSpawn;
public float batchLocation;
public float range;
2020-07-11 22:09:33 +00:00
public float jumpDistance;
public float speed;
public float lastSpawnLocation;
public PacketSpawnInfo(float period, int perSpawn, float location, float speed, float distance, float jump) {
2020-07-11 22:09:33 +00:00
timeElapsed = 0;
lastSpawnLocation = 0;
this.interval = period;
2020-07-11 22:09:33 +00:00
this.perSpawn = perSpawn;
this.batchLocation = location;
this.range = distance;
2020-07-11 22:09:33 +00:00
this.speed = speed;
this.jumpDistance = jump;
}
}
}