23 lines
630 B
C#
23 lines
630 B
C#
using UnityEngine;
|
|
|
|
namespace Code.Gameplay.Door
|
|
{
|
|
public class Door : MonoBehaviour
|
|
{
|
|
[SerializeField] private Transform hingeJointAnchor;
|
|
[SerializeField] private HingeJoint hingeJoint;
|
|
[SerializeField] private Rigidbody rigidbody;
|
|
|
|
public void TranslationMode(bool on)
|
|
{
|
|
if (on)
|
|
{
|
|
rigidbody.isKinematic = true;
|
|
return;
|
|
}
|
|
rigidbody.isKinematic = false;
|
|
hingeJoint.autoConfigureConnectedAnchor = false;
|
|
hingeJoint.connectedAnchor = hingeJointAnchor.position;
|
|
}
|
|
}
|
|
} |