First Commit
This commit is contained in:
38
Assets/SubBaseVariable.cs
Normal file
38
Assets/SubBaseVariable.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RogueUtils.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a base class for BaseVariable to allow things to have references
|
||||
/// to BaseVariable without knowing their type.
|
||||
/// </summary>
|
||||
public abstract class SubBaseVariable : ScriptableObject
|
||||
{
|
||||
private event EventHandler InternalOnChangeUntyped;
|
||||
|
||||
public event EventHandler OnChangeUntyped
|
||||
{
|
||||
add
|
||||
{
|
||||
InternalOnChangeUntyped += value;
|
||||
}
|
||||
|
||||
remove
|
||||
{
|
||||
InternalOnChangeUntyped -= value;
|
||||
}
|
||||
}
|
||||
|
||||
protected void BaseHandleValueChange()
|
||||
{
|
||||
InternalOnChangeUntyped?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public abstract T GetValue<T>();
|
||||
|
||||
public abstract object GetValueUntyped();
|
||||
|
||||
public abstract void SetValueUntyped(object value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user