particles/ParticleSimulation/ParticleType.cs

51 lines
1.4 KiB
C#
Raw Normal View History

2021-12-26 16:45:02 -05:00
using System.Collections.Generic;
using Godot;
namespace Particles.ParticleSimulation
2021-12-26 16:45:02 -05:00
{
public struct ParticleRelationshipProps
2021-12-26 16:45:02 -05:00
{
public ParticleRelationshipProps(float minRadius, float maxRadius, float force)
{
MinRadius = minRadius;
MaxRadius = maxRadius;
Force = force;
}
public float MinRadius { get; }
public float MaxRadius { get; }
public float Force { get; }
2021-12-26 16:45:02 -05:00
}
public class ParticleType
2021-12-26 21:16:28 -05:00
{
private readonly Dictionary<ParticleType, ParticleRelationshipProps> _particleRelationships =
new Dictionary<ParticleType, ParticleRelationshipProps>();
private float _hue;
public float Hue
{
get => _hue;
set => _hue = Mathf.Clamp(value, 0, 1);
}
public void AddRelationship(ParticleType type, ParticleRelationshipProps props)
{
if (_particleRelationships.ContainsKey(type))
return;
_particleRelationships[type] = props;
}
public void RemoveRelationship(ParticleType type)
{
if (_particleRelationships.ContainsKey(type))
_particleRelationships.Remove(type);
}
public ParticleRelationshipProps GetRelationship(ParticleType type)
{
return _particleRelationships[type];
}
2021-12-26 21:16:28 -05:00
}
2021-12-26 16:45:02 -05:00
}