38 lines
1012 B
C#
38 lines
1012 B
C#
|
using System.Collections.Generic;
|
||
|
using Godot;
|
||
|
|
||
|
public struct ParticleRelationshipProps
|
||
|
{
|
||
|
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; }
|
||
|
}
|
||
|
|
||
|
public class ParticleType
|
||
|
{
|
||
|
private float _hue;
|
||
|
|
||
|
private readonly Dictionary<ParticleType, ParticleRelationshipProps> _particleRelationships =
|
||
|
new Dictionary<ParticleType, ParticleRelationshipProps>();
|
||
|
|
||
|
public float Hue
|
||
|
{
|
||
|
get => _hue;
|
||
|
set => _hue = Mathf.Clamp(value, 0, 1);
|
||
|
}
|
||
|
|
||
|
public void AddRelationship(ParticleType type, float minRadius, float maxRadius, float force)
|
||
|
{
|
||
|
if (_particleRelationships.ContainsKey(type))
|
||
|
return;
|
||
|
var props = new ParticleRelationshipProps(minRadius, maxRadius, force);
|
||
|
_particleRelationships[type] = props;
|
||
|
}
|
||
|
}
|