2020-07-11 19:02:52 +00:00
|
|
|
using System;
|
|
|
|
using System.Numerics;
|
|
|
|
using SlatedGameToolkit.Framework.Graphics.Render;
|
|
|
|
using SlatedGameToolkit.Framework.Graphics.Textures;
|
|
|
|
using SlatedGameToolkit.Framework.Utilities.Collections.Pooling;
|
|
|
|
|
|
|
|
namespace SkinnerBox.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;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Update(double delta) {
|
|
|
|
this.Y -= (float)(velocity * delta);
|
|
|
|
}
|
2020-07-11 22:09:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public struct PacketSpawnInfo
|
|
|
|
{
|
|
|
|
public float timeElapsed;
|
2020-07-12 04:19:50 +00:00
|
|
|
public float interval;
|
2020-07-11 22:09:33 +00:00
|
|
|
public int perSpawn;
|
|
|
|
public float batchLocation;
|
2020-07-12 04:19:50 +00:00
|
|
|
public float range;
|
2020-07-11 22:09:33 +00:00
|
|
|
public float jumpDistance;
|
|
|
|
public float speed;
|
|
|
|
public float lastSpawnLocation;
|
2020-07-11 19:02:52 +00:00
|
|
|
|
2020-07-12 04:19:50 +00:00
|
|
|
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;
|
2020-07-12 04:19:50 +00:00
|
|
|
this.interval = period;
|
2020-07-11 22:09:33 +00:00
|
|
|
this.perSpawn = perSpawn;
|
|
|
|
this.batchLocation = location;
|
2020-07-12 04:19:50 +00:00
|
|
|
this.range = distance;
|
2020-07-11 22:09:33 +00:00
|
|
|
this.speed = speed;
|
|
|
|
this.jumpDistance = jump;
|
|
|
|
}
|
2020-07-11 19:02:52 +00:00
|
|
|
}
|
|
|
|
}
|