particles/ParticleType.cs

42 lines
1.0 KiB
C#
Raw Normal View History

2021-12-26 16:45:02 -05:00
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 readonly Dictionary<ParticleType, ParticleRelationshipProps> _particleRelationships =
new Dictionary<ParticleType, ParticleRelationshipProps>();
2021-12-26 21:16:28 -05:00
private float _hue;
2021-12-26 16:45:02 -05:00
public float Hue
{
get => _hue;
set => _hue = Mathf.Clamp(value, 0, 1);
}
2021-12-27 14:58:33 -05:00
public void AddRelationship(ParticleType type, ParticleRelationshipProps props)
2021-12-26 16:45:02 -05:00
{
if (_particleRelationships.ContainsKey(type))
return;
_particleRelationships[type] = props;
}
2021-12-26 21:16:28 -05:00
public ParticleRelationshipProps GetRelationship(ParticleType type)
{
return _particleRelationships[type];
}
2021-12-26 16:45:02 -05:00
}