2020-03-17 19:17:33 -04:00
|
|
|
using System;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace UnityAtoms.BaseAtoms
|
|
|
|
{
|
|
|
|
[EditorIcon("atom-icon-hotpink")]
|
|
|
|
[DefaultExecutionOrder(Runtime.ExecutionOrder.VARIABLE_INSTANCER)]
|
2020-03-19 03:39:43 -04:00
|
|
|
public abstract class AtomBaseCollectionInstancer<T, V> : AtomBaseVariableInstancer<T, V>
|
2020-03-17 19:17:33 -04:00
|
|
|
where V : AtomBaseVariable<T>, IWithCollectionEvents
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Override to add implementation specific setup on `OnEnable`.
|
|
|
|
/// </summary>
|
|
|
|
protected override void ImplSpecificSetup()
|
|
|
|
{
|
|
|
|
var baseCollection = (V)Base;
|
|
|
|
var inMemoryCopy = (V)_inMemoryCopy;
|
|
|
|
|
|
|
|
if (baseCollection.Added != null)
|
|
|
|
{
|
|
|
|
inMemoryCopy.Added = Instantiate(baseCollection.Added);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (baseCollection.Removed != null)
|
|
|
|
{
|
|
|
|
inMemoryCopy.Removed = Instantiate(baseCollection.Removed);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (baseCollection.Cleared != null)
|
|
|
|
{
|
|
|
|
inMemoryCopy.Cleared = Instantiate(baseCollection.Cleared);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|