36 lines
700 B
C#
36 lines
700 B
C#
using Obvious.Soap;
|
|
using UnityEngine;
|
|
|
|
public class LureDepthSetting : MonoBehaviourExtended
|
|
{
|
|
[SerializeField]
|
|
private FloatVariable lureDepth;
|
|
|
|
[SerializeField]
|
|
private BoolVariable isLureDepthSettingEnabled;
|
|
|
|
[OwnComponent(0)]
|
|
private ConfigurableJoint joint;
|
|
|
|
private void OnEnable()
|
|
{
|
|
isLureDepthSettingEnabled.Value = true;
|
|
lureDepth.OnValueChanged += LureDepth_OnValueChanged;
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
isLureDepthSettingEnabled.Value = false;
|
|
lureDepth.OnValueChanged -= LureDepth_OnValueChanged;
|
|
}
|
|
|
|
private void LureDepth_OnValueChanged(float obj)
|
|
{
|
|
SoftJointLimit linearLimit = new SoftJointLimit
|
|
{
|
|
limit = obj
|
|
};
|
|
joint.linearLimit = linearLimit;
|
|
}
|
|
}
|