restructured project
This commit is contained in:
42
ParticleSimulation/Simulation/Particle.cs
Normal file
42
ParticleSimulation/Simulation/Particle.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Godot;
|
||||
|
||||
namespace Particles.ParticleSimulation
|
||||
{
|
||||
public class Particle
|
||||
{
|
||||
private float _health = 1f;
|
||||
|
||||
public Vector2 Position = new Vector2();
|
||||
public bool WasTeleportedLast = true;
|
||||
public Vector2 Velocity = new Vector2();
|
||||
|
||||
public Particle(int id, ParticleType type)
|
||||
{
|
||||
Id = id;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public ParticleType Type { get; }
|
||||
public float AverageSpeed { get; private set; } = 1f;
|
||||
|
||||
// ReSharper disable once UnusedAutoPropertyAccessor.Global
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
public int Id { get; }
|
||||
|
||||
public float Health
|
||||
{
|
||||
get => _health;
|
||||
set => _health = Mathf.Clamp(value, 0f, 1f);
|
||||
}
|
||||
|
||||
public void AddAverageSpeedValue(float speed)
|
||||
{
|
||||
AverageSpeed = 0.99f * AverageSpeed + 0.01f * speed;
|
||||
}
|
||||
|
||||
public void ResetAverageSpeed()
|
||||
{
|
||||
AverageSpeed = 1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user