33 lines
753 B
C#
33 lines
753 B
C#
using Godot;
|
|
|
|
namespace Particles
|
|
{
|
|
public class Particle
|
|
{
|
|
|
|
public Vector2 Position = new Vector2();
|
|
public Vector2 Velocity = new Vector2();
|
|
public ParticleType Type { get; }
|
|
public float AverageSpeed { get; private set; } = 1f;
|
|
|
|
public int Id { get; }
|
|
public float Health
|
|
{
|
|
get => _health;
|
|
set => _health = Mathf.Clamp(value, 0f, 1f);
|
|
}
|
|
|
|
private float _health = 1f;
|
|
|
|
public Particle(int id, ParticleType type)
|
|
{
|
|
Id = id;
|
|
Type = type;
|
|
}
|
|
|
|
public void AddAverageSpeedValue(float speed)
|
|
{
|
|
AverageSpeed = (0.99f * AverageSpeed) + (0.01f * speed);
|
|
}
|
|
}
|
|
} |