init
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
// Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2024 Kybernetik //
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Animancer
|
||||
{
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/AnimancerEvent
|
||||
partial struct AnimancerEvent
|
||||
{
|
||||
/// <summary>A non-generic interface for <see cref="Parameter{T}"/>.</summary>
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/IParameter
|
||||
public interface IParameter
|
||||
{
|
||||
/************************************************************************************************************************/
|
||||
|
||||
/// <summary>The parameter value.</summary>
|
||||
object Value { get; set; }
|
||||
|
||||
/************************************************************************************************************************/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base class for <see cref="IInvokable"/>s which assign the <see cref="CurrentParameter"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Inherit from <see cref="ParameterBoxed{T}"/>
|
||||
/// instead of this if <typeparamref name="T"/> is a value type to avoid repeated boxing costs.
|
||||
/// </remarks>
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/Parameter_1
|
||||
public abstract class Parameter<T> :
|
||||
IParameter,
|
||||
IInvokable
|
||||
{
|
||||
/************************************************************************************************************************/
|
||||
|
||||
[SerializeField]
|
||||
private T _Value;
|
||||
|
||||
/// <summary>[<see cref="SerializeField"/>] The serialized <typeparamref name="T"/>.</summary>
|
||||
public virtual T Value
|
||||
{
|
||||
get => _Value;
|
||||
set => _Value = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
object IParameter.Value
|
||||
{
|
||||
get => _Value;
|
||||
set => _Value = (T)value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public virtual void Invoke()
|
||||
{
|
||||
CurrentParameter = _Value;
|
||||
Current.InvokeBoundCallback();
|
||||
}
|
||||
|
||||
/************************************************************************************************************************/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5927c425f3f0c0e4baeb0cd737707442
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
// Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2024 Kybernetik //
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Animancer
|
||||
{
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/AnimancerEvent
|
||||
partial struct AnimancerEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// An <see cref="Parameter{T}"/>s which internally boxes value types
|
||||
/// to avoid re-boxing them every <see cref="Invoke"/>.
|
||||
/// </summary>
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/ParameterBoxed_1
|
||||
public abstract class ParameterBoxed<T> : Parameter<T>,
|
||||
IParameter
|
||||
#if UNITY_EDITOR
|
||||
, ISerializationCallbackReceiver
|
||||
#endif
|
||||
where T : struct
|
||||
{
|
||||
/************************************************************************************************************************/
|
||||
|
||||
private object _Boxed;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override T Value
|
||||
{
|
||||
get => base.Value;
|
||||
set
|
||||
{
|
||||
base.Value = value;
|
||||
_Boxed = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
object IParameter.Value
|
||||
{
|
||||
get => Value;
|
||||
set => Value = (T)value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Invoke()
|
||||
{
|
||||
CurrentParameter = _Boxed ??= base.Value;
|
||||
Current.InvokeBoundCallback();
|
||||
}
|
||||
|
||||
/************************************************************************************************************************/
|
||||
#if UNITY_EDITOR
|
||||
/************************************************************************************************************************/
|
||||
|
||||
/// <inheritdoc/>
|
||||
void ISerializationCallbackReceiver.OnBeforeSerialize() { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
void ISerializationCallbackReceiver.OnAfterDeserialize()
|
||||
=> _Boxed = null;
|
||||
|
||||
/************************************************************************************************************************/
|
||||
#endif
|
||||
/************************************************************************************************************************/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30eb95e632f815a49a7ac0f1d68cb006
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
// Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2024 Kybernetik //
|
||||
|
||||
using System;
|
||||
|
||||
namespace Animancer
|
||||
{
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/AnimancerEvent
|
||||
partial struct AnimancerEvent
|
||||
{
|
||||
/************************************************************************************************************************/
|
||||
// Reference Types.
|
||||
/************************************************************************************************************************/
|
||||
|
||||
/// <summary>An <see cref="Parameter{T}"/> for <see cref="UnityEngine.Object"/>.</summary>
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/ParameterObject
|
||||
[Serializable]
|
||||
public class ParameterObject : Parameter<UnityEngine.Object> { }
|
||||
|
||||
/// <summary>An <see cref="Parameter{T}"/> for <see cref="string"/>.</summary>
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/ParameterString
|
||||
[Serializable]
|
||||
public class ParameterString : Parameter<string> { }
|
||||
|
||||
/************************************************************************************************************************/
|
||||
// Value Types.
|
||||
/************************************************************************************************************************/
|
||||
|
||||
/// <summary>An <see cref="Parameter{T}"/> for <see cref="bool"/>.</summary>
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/ParameterBool
|
||||
[Serializable]
|
||||
public class ParameterBool : ParameterBoxed<bool> { }
|
||||
|
||||
/// <summary>An <see cref="Parameter{T}"/> for <see cref="double"/>.</summary>
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/ParameterDouble
|
||||
[Serializable]
|
||||
public class ParameterDouble : ParameterBoxed<double> { }
|
||||
|
||||
/// <summary>An <see cref="Parameter{T}"/> for <see cref="float"/>.</summary>
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/ParameterFloat
|
||||
[Serializable]
|
||||
public class ParameterFloat : ParameterBoxed<float> { }
|
||||
|
||||
/// <summary>An <see cref="Parameter{T}"/> for <see cref="int"/>.</summary>
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/ParameterInt
|
||||
[Serializable]
|
||||
public class ParameterInt : ParameterBoxed<int> { }
|
||||
|
||||
/// <summary>An <see cref="Parameter{T}"/> for <see cref="long"/>.</summary>
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/ParameterLong
|
||||
[Serializable]
|
||||
public class ParameterLong : ParameterBoxed<long> { }
|
||||
|
||||
/************************************************************************************************************************/
|
||||
}
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ddc1c2d634269b94891d46befabcb48b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,16 @@
|
||||
// Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2024 Kybernetik //
|
||||
|
||||
#if ULT_EVENTS
|
||||
|
||||
using System;
|
||||
|
||||
namespace Animancer
|
||||
{
|
||||
/// <summary>An <see cref="UltEvents.UltEvent"/> which implements <see cref="IInvokable"/>.</summary>
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/UltEvent
|
||||
[Serializable]
|
||||
public class UltEvent : UltEvents.UltEvent, IInvokable { }
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03d1988336fb5dd4ab091ab50047a06f
|
||||
timeCreated: 1515060256
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
// Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2024 Kybernetik //
|
||||
|
||||
using System;
|
||||
|
||||
namespace Animancer
|
||||
{
|
||||
/// <summary>A <see cref="UnityEngine.Events.UnityEvent"/> which implements <see cref="IInvokable"/>.</summary>
|
||||
/// https://kybernetik.com.au/animancer/api/Animancer/UnityEvent
|
||||
[Serializable]
|
||||
public class UnityEvent : UnityEngine.Events.UnityEvent, IInvokable { }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9391a6fb545883c44a19bb0c1f8b2589
|
||||
timeCreated: 1515060256
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user