mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-24 00:58:59 -05:00
23 lines
769 B
C#
23 lines
769 B
C#
using UnityEngine;
|
|
|
|
namespace UnityAtoms
|
|
{
|
|
/// <summary>
|
|
/// Variable of type `float`. Inherits from `EquatableAtomVariable<float, FloatEvent, FloatFloatEvent>`.
|
|
/// </summary>
|
|
[EditorIcon("atom-icon-lush")]
|
|
[CreateAssetMenu(menuName = "Unity Atoms/Variables/Float", fileName = "FloatVariable")]
|
|
public sealed class FloatVariable : EquatableAtomVariable<float, FloatEvent, FloatFloatEvent>, IWithApplyChange<float, FloatEvent, FloatFloatEvent>
|
|
{
|
|
public bool ApplyChange(float amount)
|
|
{
|
|
return SetValue(Value + amount);
|
|
}
|
|
|
|
public bool ApplyChange(EquatableAtomVariable<float, FloatEvent, FloatFloatEvent> amount)
|
|
{
|
|
return SetValue(Value + amount.Value);
|
|
}
|
|
}
|
|
}
|