Files
Ultimate-Fishing-Simulator-…/Assets/Scripts/Assembly-CSharp/TargetLocker.cs
2026-03-04 09:37:33 +08:00

50 lines
680 B
C#

using UnityEngine;
public class TargetLocker : MonoBehaviour
{
public enum UpdateType
{
update = 0,
late = 1,
fixedUpdate = 2
}
public UpdateType type;
public Transform target;
public Vector3 Offset;
public Quaternion RotationOffset;
private void UpdatePosition()
{
target.GetPositionAndRotation(out var position, out var _);
base.transform.position = position;
}
private void Update()
{
if (type == UpdateType.update)
{
UpdatePosition();
}
}
private void FixedUpdate()
{
if (type == UpdateType.fixedUpdate)
{
UpdatePosition();
}
}
private void LateUpdate()
{
if (type == UpdateType.late)
{
UpdatePosition();
}
}
}