mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-23 16:48:23 -05:00
bdf81a5e9c
commit 847eff037204d841546c0da772d2f341f9cf1e25 Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Sun Mar 17 22:09:38 2019 +0100 #17 - Serializable not needed for ScriptableObject commit 593b275e6394b9d589de8a7a20375145dfc4aa84 Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Sun Mar 17 21:59:33 2019 +0100 18 - IGameEvent<T1, T2> RegisterListener commit 40443ce9bd4b1c339aaf19cfcb119f2336608dae Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Fri Mar 8 16:35:04 2019 +0100 Remove some more warnings commit bd453110ac51a6ebe3d54368fcb039bdbe52e278 Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Fri Mar 8 16:33:30 2019 +0100 Update README commit 90977b853a047c84efb5311768a09f4e8a1165b2 Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Fri Mar 8 16:31:45 2019 +0100 Initialize to null to get rid off warnings commit 38b7f5c4ede195aa7198f567801c9cbeedc9b6f6 Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Fri Mar 8 16:15:53 2019 +0100 More fixes to enable local unity project commit 404e1cbf88ed4431c61d3ece074e838e74ac5141 Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Fri Mar 8 16:12:37 2019 +0100 Remove duplicated asmdef commit 5734300684e8a16553f213157cad1b4722b7cb7f Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Fri Mar 8 16:09:46 2019 +0100 Change files to include commit d1e42b119a6bc1577b1792459fa298e063652337 Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Fri Mar 8 16:05:56 2019 +0100 Added root package json commit 1709a0347147d74460f653182bbaf8d15eb6154e Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Fri Mar 8 15:30:44 2019 +0100 #16 - Add test and examples Unity project commit a3ea1a133bf6727e011ba85c64569db45302e487 Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Fri Mar 8 13:12:02 2019 +0100 #13 - Make usage of UPM (package manager) commit 492a30e905f6cf3f5899cb7080ef2bda73110f00 Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Fri Mar 8 11:28:56 2019 +0100 Added extensions + code formatting fixes commit 709949a1016c236cfd363cf25392fedfd8d083ca Author: Oliver Biwer <soraphis@users.noreply.github.com> Date: Fri Mar 8 10:16:45 2019 +0100 More AtomicTags changes (#15) * - added assembly defintions, and unit tests - improved AtomicTags in regards of #8, #9 and #10 * Fixes #11 - Added Equality Members (inclusive HashCode) for ScriptableObjectVariableBase * removed Rider Plugins from git * Further AtomicTag optimization commit ae6584c879f182e727fe0a8d0aff4b0715829914 Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Fri Mar 8 10:08:36 2019 +0100 Editor config commit 197d7067608600e4e2d13dc42db909ee8f8c75df Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Fri Mar 8 09:23:12 2019 +0100 Added editor config file commit53d6adc07b
Author: Oliver Biwer <soraphis@users.noreply.github.com> Date: Tue Mar 5 22:57:47 2019 +0100 More efficient AtomicTags (#12) * - added assembly defintions, and unit tests - improved AtomicTags in regards of #8, #9 and #10 * Fixes #11 - Added Equality Members (inclusive HashCode) for ScriptableObjectVariableBase * removed Rider Plugins from git commit81209d83b5
Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Wed Dec 12 20:54:17 2018 +0100 Added MonoHooks + ColliderType + bug fixes commitc6b240cebb
Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Sat Dec 1 00:23:10 2018 +0100 Experimenting with adding UI state management commitdfd70a8944
Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Fri Nov 30 23:10:21 2018 +0100 Issue #6 - AtomicTags commit8907763227
Author: Adam Ramberg <andersson.adam.89@gmail.com> Date: Fri Nov 30 22:42:29 2018 +0100 First commit of v1.0.0
56 lines
2.0 KiB
C#
56 lines
2.0 KiB
C#
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
using UnityAtoms.Utils;
|
|
|
|
namespace UnityAtoms
|
|
{
|
|
public class CreateVariableOnAwake<T, V, E1, E2, L1, L2, GA1, GA2, GA3, GA4, UER1, UER2> : MonoBehaviour
|
|
where V : ScriptableObjectVariable<T, E1, E2> where E1 : GameEvent<T> where E2 : GameEvent<T, T>
|
|
where L1 : GameEventListener<T, GA1, E1, UER1> where L2 : GameEventListener<T, T, GA2, E2, UER2>
|
|
where GA1 : GameAction<T> where GA2 : GameAction<T, T>
|
|
where GA3 : GameAction<V> where GA4 : GameAction<V, GameObject>
|
|
where UER1 : UnityEvent<T> where UER2 : UnityEvent<T, T>
|
|
{
|
|
[SerializeField]
|
|
private bool CreateChangedEvent = true;
|
|
[SerializeField]
|
|
private bool CreateChangedWithHistoryEvent = false;
|
|
|
|
[SerializeField]
|
|
private L1 Listener = null;
|
|
[SerializeField]
|
|
private L2 ListenerWithHistory = null;
|
|
|
|
[SerializeField]
|
|
private GA3 OnVariableCreate = null;
|
|
[SerializeField]
|
|
private GA4 OnVariableCreateWithGO = null;
|
|
|
|
void Awake()
|
|
{
|
|
var variable = DynamicAtoms.CreateVariable<T, V, E1, E2>(CreateChangedEvent, CreateChangedWithHistoryEvent);
|
|
|
|
if (variable.Changed != null)
|
|
{
|
|
if (Listener != null)
|
|
{
|
|
Listener.GameEvent = variable.Changed;
|
|
Listener.GameEvent.RegisterListener(Listener);
|
|
}
|
|
}
|
|
if (variable.ChangedWithHistory != null)
|
|
{
|
|
if (ListenerWithHistory != null)
|
|
{
|
|
ListenerWithHistory.GameEvent = variable.ChangedWithHistory;
|
|
ListenerWithHistory.GameEvent.RegisterListener(ListenerWithHistory);
|
|
}
|
|
}
|
|
if (OnVariableCreate != null) { OnVariableCreate.Do(variable); }
|
|
if (OnVariableCreateWithGO != null) { OnVariableCreateWithGO.Do(variable, gameObject); }
|
|
}
|
|
}
|
|
}
|