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