Upload from upload_mods.ps1
This commit is contained in:
69
KFAttached/KFUtilAttached/RigActivationBinding.cs
Normal file
69
KFAttached/KFUtilAttached/RigActivationBinding.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Animations.Rigging;
|
||||
|
||||
[AddComponentMenu("KFAttachments/Binding Helpers/Rig Activation Binding")]
|
||||
public class RigActivationBinding : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private RigLayer[] bindings;
|
||||
[SerializeField]
|
||||
private RigLayer[] inverseBindings;
|
||||
[SerializeField]
|
||||
private RigLayer[] enableOnDisable;
|
||||
[SerializeField]
|
||||
private RigLayer[] disableOnEnable;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
//Log.Out(gameObject.name + " OnEnable!");
|
||||
if (bindings != null)
|
||||
{
|
||||
foreach (RigLayer t in bindings)
|
||||
if (t != null)
|
||||
t.active = true;
|
||||
}
|
||||
if (inverseBindings != null)
|
||||
{
|
||||
foreach (RigLayer t in inverseBindings)
|
||||
{
|
||||
if (t != null)
|
||||
t.active = false;
|
||||
}
|
||||
}
|
||||
if (disableOnEnable != null)
|
||||
{
|
||||
foreach (RigLayer t in disableOnEnable)
|
||||
{
|
||||
if (t != null)
|
||||
t.active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
//Log.Out(gameObject.name + " OnDisable!");
|
||||
if (bindings != null)
|
||||
{
|
||||
foreach (RigLayer t in bindings)
|
||||
if (t != null)
|
||||
t.active = false;
|
||||
}
|
||||
if (inverseBindings != null)
|
||||
{
|
||||
foreach (RigLayer t in inverseBindings)
|
||||
{
|
||||
if (t != null)
|
||||
t.active = true;
|
||||
}
|
||||
}
|
||||
if (enableOnDisable != null)
|
||||
{
|
||||
foreach (RigLayer t in enableOnDisable)
|
||||
{
|
||||
if (t != null)
|
||||
t.active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user