mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-22 08:08:51 -05:00
Added MonoHooks + ColliderType + bug fixes
This commit is contained in:
parent
c6b240cebb
commit
81209d83b5
@ -8,7 +8,7 @@ namespace UnityAtoms
|
|||||||
{
|
{
|
||||||
protected override bool AreEqual(T t1, T t2)
|
protected override bool AreEqual(T t1, T t2)
|
||||||
{
|
{
|
||||||
return t1.Equals(t2);
|
return (t1 == null && t2 == null) || (t1 != null && t1.Equals(t2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,6 +18,12 @@ namespace UnityAtoms
|
|||||||
|
|
||||||
protected abstract bool AreEqual(T first, T second);
|
protected abstract bool AreEqual(T first, T second);
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
if (Changed == null) return;
|
||||||
|
Changed.Raise(Value);
|
||||||
|
}
|
||||||
|
|
||||||
public bool SetValue(T value)
|
public bool SetValue(T value)
|
||||||
{
|
{
|
||||||
if (!AreEqual(this.value, value))
|
if (!AreEqual(this.value, value))
|
||||||
|
8
Assets/UnityAtoms/Collider.meta
Normal file
8
Assets/UnityAtoms/Collider.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 19a3e6ed503f94466baa77a854e3ccf6
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
7
Assets/UnityAtoms/Collider/ColliderEvent.cs
Normal file
7
Assets/UnityAtoms/Collider/ColliderEvent.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace UnityAtoms
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(menuName = "Unity Atoms/Collider/Event", fileName = "ColliderEvent", order = CreateAssetMenuUtils.Order.EVENT)]
|
||||||
|
public class ColliderEvent : GameEvent<Collider> { }
|
||||||
|
}
|
11
Assets/UnityAtoms/Collider/ColliderEvent.cs.meta
Normal file
11
Assets/UnityAtoms/Collider/ColliderEvent.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9a0a99be4f0e5466e85ab5428c8b4c22
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
6
Assets/UnityAtoms/Collider/ColliderGameObjectAction.cs
Normal file
6
Assets/UnityAtoms/Collider/ColliderGameObjectAction.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace UnityAtoms
|
||||||
|
{
|
||||||
|
public abstract class ColliderGameObjectAction : GameAction<Collider, GameObject> { }
|
||||||
|
}
|
11
Assets/UnityAtoms/Collider/ColliderGameObjectAction.cs.meta
Normal file
11
Assets/UnityAtoms/Collider/ColliderGameObjectAction.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b93e5af67c0004a378b9efbea3b2cae2
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Assets/UnityAtoms/Collider/ColliderGameObjectEvent.cs
Normal file
8
Assets/UnityAtoms/Collider/ColliderGameObjectEvent.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace UnityAtoms
|
||||||
|
{
|
||||||
|
|
||||||
|
[CreateAssetMenu(menuName = "Unity Atoms/Collider/Event with GameObject", fileName = "ColliderGameObjectEvent", order = CreateAssetMenuUtils.Order.EVENT_WITH_GO)]
|
||||||
|
public class ColliderGameObjectEvent : GameEvent<Collider, GameObject> { }
|
||||||
|
}
|
11
Assets/UnityAtoms/Collider/ColliderGameObjectEvent.cs.meta
Normal file
11
Assets/UnityAtoms/Collider/ColliderGameObjectEvent.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 97acb23837b164301851f57d79bc7731
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
6
Assets/UnityAtoms/Collider/ColliderGameObjectListener.cs
Normal file
6
Assets/UnityAtoms/Collider/ColliderGameObjectListener.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace UnityAtoms
|
||||||
|
{
|
||||||
|
public class ColliderGameObjectListener : GameEventListener<Collider, GameObject, ColliderGameObjectAction, ColliderGameObjectEvent, UnityColliderGameObjectEvent> { }
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 777a7f3042ff1464d939cac8b14987bb
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,9 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace UnityAtoms
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class UnityColliderGameObjectEvent : UnityEvent<Collider, GameObject> { }
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 228a51df221d041fb8c3075c0a7c6ff5
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
21
Assets/UnityAtoms/Extensions/MonoBehaviourExtensions.cs
Normal file
21
Assets/UnityAtoms/Extensions/MonoBehaviourExtensions.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace UnityAtoms
|
||||||
|
{
|
||||||
|
public static class MonoBehaviourExtensions
|
||||||
|
{
|
||||||
|
public static void WaitThenDo(this MonoBehaviour mb, float delay, Action onComplete)
|
||||||
|
{
|
||||||
|
mb.StartCoroutine(Routine(delay, onComplete));
|
||||||
|
}
|
||||||
|
|
||||||
|
static IEnumerator Routine(float delay, Action onComplete)
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(delay);
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/UnityAtoms/Extensions/MonoBehaviourExtensions.cs.meta
Normal file
11
Assets/UnityAtoms/Extensions/MonoBehaviourExtensions.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b9bb3a029ccc8479ab6abba932404203
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,4 +1,5 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityAtoms.Utils;
|
||||||
|
|
||||||
namespace UnityAtoms
|
namespace UnityAtoms
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@ namespace UnityAtoms
|
|||||||
{
|
{
|
||||||
protected override bool AreEqual(GameObject first, GameObject second)
|
protected override bool AreEqual(GameObject first, GameObject second)
|
||||||
{
|
{
|
||||||
return first.GetInstanceID() == second.GetInstanceID();
|
return (first == null && second == null) || first != null && second != null && first.GetInstanceID() == second.GetInstanceID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
6
Assets/UnityAtoms/MonoHooks/ColliderHook.cs
Normal file
6
Assets/UnityAtoms/MonoHooks/ColliderHook.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace UnityAtoms
|
||||||
|
{
|
||||||
|
public abstract class ColliderHook : MonoHook<ColliderEvent, ColliderGameObjectEvent, Collider, GameObjectGameObjectFunction> { }
|
||||||
|
}
|
11
Assets/UnityAtoms/MonoHooks/ColliderHook.cs.meta
Normal file
11
Assets/UnityAtoms/MonoHooks/ColliderHook.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6178fc51652f042a4842d227c32e3ec8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
12
Assets/UnityAtoms/MonoHooks/OnTriggerEnterHook.cs
Normal file
12
Assets/UnityAtoms/MonoHooks/OnTriggerEnterHook.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace UnityAtoms
|
||||||
|
{
|
||||||
|
public class OnTriggerEnterHook : ColliderHook
|
||||||
|
{
|
||||||
|
private void OnTriggerEnter(Collider other)
|
||||||
|
{
|
||||||
|
OnHook(other);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/UnityAtoms/MonoHooks/OnTriggerEnterHook.cs.meta
Normal file
11
Assets/UnityAtoms/MonoHooks/OnTriggerEnterHook.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ee605babb03dd4a9aa98b28757d00047
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
12
Assets/UnityAtoms/MonoHooks/OnTriggerStayHook.cs
Normal file
12
Assets/UnityAtoms/MonoHooks/OnTriggerStayHook.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace UnityAtoms
|
||||||
|
{
|
||||||
|
public class OnTriggerStayHook : ColliderHook
|
||||||
|
{
|
||||||
|
private void OnTriggerStay(Collider other)
|
||||||
|
{
|
||||||
|
OnHook(other);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/UnityAtoms/MonoHooks/OnTriggerStayHook.cs.meta
Normal file
11
Assets/UnityAtoms/MonoHooks/OnTriggerStayHook.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1008d086c876a4a198f56bb01beed940
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
10
Assets/UnityAtoms/String/CreateStringVariableOnAwake.cs
Normal file
10
Assets/UnityAtoms/String/CreateStringVariableOnAwake.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityAtoms;
|
||||||
|
public class CreateStringVariableOnAwake : CreateVariableOnAwake<string, StringVariable, StringEvent, StringStringEvent,
|
||||||
|
StringListener, StringStringListener, StringAction, StringStringAction,
|
||||||
|
StringVariableAction, StringVariableGameObjectAction, UnityStringEvent, UnityStringStringEvent>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
11
Assets/UnityAtoms/String/CreateStringVariableOnAwake.cs.meta
Normal file
11
Assets/UnityAtoms/String/CreateStringVariableOnAwake.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0450d456d77ba41698db58950a60ef38
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
4
Assets/UnityAtoms/String/StringStringAction.cs
Normal file
4
Assets/UnityAtoms/String/StringStringAction.cs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
namespace UnityAtoms
|
||||||
|
{
|
||||||
|
public abstract class StringStringAction : GameAction<string, string> { }
|
||||||
|
}
|
11
Assets/UnityAtoms/String/StringStringAction.cs.meta
Normal file
11
Assets/UnityAtoms/String/StringStringAction.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0fad6e346f8f94ec79db7926d050eafa
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
6
Assets/UnityAtoms/String/StringStringListener.cs
Normal file
6
Assets/UnityAtoms/String/StringStringListener.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace UnityAtoms
|
||||||
|
{
|
||||||
|
public class StringStringListener : GameEventListener<string, string, StringStringAction, StringStringEvent, UnityStringStringEvent> { }
|
||||||
|
}
|
11
Assets/UnityAtoms/String/StringStringListener.cs.meta
Normal file
11
Assets/UnityAtoms/String/StringStringListener.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 476a9677f1c584b518fefac787fd9387
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
4
Assets/UnityAtoms/String/StringVariableAction.cs
Normal file
4
Assets/UnityAtoms/String/StringVariableAction.cs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
namespace UnityAtoms
|
||||||
|
{
|
||||||
|
public abstract class StringVariableAction : GameAction<StringVariable> { }
|
||||||
|
}
|
11
Assets/UnityAtoms/String/StringVariableAction.cs.meta
Normal file
11
Assets/UnityAtoms/String/StringVariableAction.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 886ad0495656944c69e086799d1d111d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,6 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace UnityAtoms
|
||||||
|
{
|
||||||
|
public abstract class StringVariableGameObjectAction : GameAction<StringVariable, GameObject> { }
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 819aa72b755dd44e4ac7200ec0594b62
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -5,4 +5,7 @@ namespace UnityAtoms
|
|||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class UnityStringEvent : UnityEvent<string> { }
|
public class UnityStringEvent : UnityEvent<string> { }
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class UnityStringStringEvent : UnityEvent<string, string> { }
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user