mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 01:58:30 +00:00
60 lines
1.5 KiB
C#
60 lines
1.5 KiB
C#
// ReSharper disable MemberCanBePrivate.Global
|
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
|
// ReSharper disable UnusedMember.Global
|
|
|
|
namespace RGB.NET.Core
|
|
{
|
|
/// <summary>
|
|
/// Represents a basic effect targeting an <see cref="ILedGroup"/>.
|
|
/// </summary>
|
|
public abstract class AbstractLedGroupEffect<T> : IEffect<ILedGroup>
|
|
where T : ILedGroup
|
|
{
|
|
#region Properties & Fields
|
|
|
|
/// <inheritdoc />
|
|
public bool IsEnabled { get; set; } = true;
|
|
|
|
/// <inheritdoc />
|
|
public bool IsDone { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// Gets the <see cref="ILedGroup"/> this effect is targeting.
|
|
/// </summary>
|
|
protected T LedGroup { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
/// <inheritdoc />
|
|
public abstract void Update(double deltaTime);
|
|
|
|
/// <inheritdoc />
|
|
public virtual bool CanBeAppliedTo(ILedGroup target)
|
|
{
|
|
return target is T;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public virtual void OnAttach(ILedGroup target)
|
|
{
|
|
LedGroup = (T)target;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public virtual void OnDetach(ILedGroup target)
|
|
{
|
|
LedGroup = default(T);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents a basic effect targeting an <see cref="ILedGroup"/>.
|
|
/// </summary>
|
|
public abstract class AbstractLedGroupEffect : AbstractLedGroupEffect<ILedGroup>
|
|
{ }
|
|
}
|