79 lines
2.2 KiB
C#
79 lines
2.2 KiB
C#
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
using DG.Tweening;
|
|
/// <summary>
|
|
/// 限制旋转的类型枚举
|
|
/// </summary>
|
|
namespace ZXK.GYJQR
|
|
{
|
|
public enum LockRoateType
|
|
{
|
|
LockX,//锁定X轴
|
|
LockY,//锁定Y轴
|
|
LockZ,//锁定Z轴
|
|
None
|
|
}
|
|
/// <summary>
|
|
/// 路径动画管理类
|
|
/// </summary>
|
|
public class PathManager : MonoBehaviour//, IModelData
|
|
{
|
|
public Transform _JieTouFinishTran;
|
|
public UnityEvent onMouseDown;//鼠标点击事件
|
|
public AdjustAngleMenu adjustAngleMenu;//UI提示画布界面
|
|
[HideInInspector]
|
|
public string modelTag;//当前物件的tag值
|
|
[HideInInspector]
|
|
public ModelData modelData;//物件数据类对象
|
|
[Header("限制旋转的轴向枚举")]
|
|
public LockRoateType lockRoateType;//限制旋转的轴向枚举
|
|
|
|
public float maxValue = 0.5f;//最大限制距离
|
|
public Transform limitCenterTran;//最大限制中心
|
|
public float limitYPos;//最大限制中心
|
|
private void Awake()
|
|
{
|
|
if (!GetComponent<Collider>())
|
|
{
|
|
gameObject.AddComponent<BoxCollider>();
|
|
}
|
|
}
|
|
private void Start()
|
|
{
|
|
//if (!string.IsNullOrEmpty(gameObject.tag))
|
|
//{
|
|
// modelTag = gameObject.tag;
|
|
// modelData = new ModelData(gameObject, transform.rotation, transform.position, modelTag, this);
|
|
// InitModelData(modelData);
|
|
//}
|
|
}
|
|
public void OnMouseDown()
|
|
{
|
|
if (GetComponent<MouseEventListener>() != null)
|
|
{
|
|
MouseEventListener mp = GetComponent<MouseEventListener>();
|
|
if (mp.isAdsorbing)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
onMouseDown?.Invoke();
|
|
}
|
|
/// <summary>
|
|
///// 实现接口
|
|
///// </summary>
|
|
///// <param name="data"></param>
|
|
//public void InitModelData(ModelData data)
|
|
//{
|
|
// ModelManager.Instance.AddModelData(data);
|
|
//}
|
|
/// <summary>
|
|
/// 执行中断Dotween插件进程的函数
|
|
/// </summary>
|
|
public void OnEnd()
|
|
{
|
|
transform.DOKill();
|
|
}
|
|
}
|
|
}
|