using UnityEngine; using UnityEngine.Serialization; namespace WSMGameStudio.Splines { public class BakedSegment : MonoBehaviour { [FormerlySerializedAs("endPoint")] [SerializeField] private Transform _endPoint; [SerializeField] private GameObject _operationTarget; public Transform EndPoint { get { return _endPoint; } set { _endPoint = value; } } public GameObject OperationTarget { get { return _operationTarget; } set { _operationTarget = value; } } /// /// Connect target at the end of this segment /// public void ConnectTarget() { ConnectTarget(_operationTarget); } /// /// Connect target at the end of this segment /// /// public void ConnectTarget(GameObject target) { if (_endPoint == null) { Debug.Log(string.Format("{0}: End point not found", name)); return; } if (target != null) { target.transform.position = _endPoint.position; target.transform.rotation = _endPoint.rotation; } ResetOperationTarget(); } /// /// Reset operation target /// private void ResetOperationTarget() { _operationTarget = null; } } }