98 lines
2.4 KiB
C#
98 lines
2.4 KiB
C#
using System;
|
|
using DefaultNamespace;
|
|
using DefaultNamespace.ProcessMode;
|
|
using HighlightPlus;
|
|
using MotionFramework;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
namespace ToolsPack
|
|
{
|
|
/// <summary>
|
|
/// 附着在工具模型上
|
|
/// </summary>
|
|
[RequireComponent(typeof(BoxCollider))]
|
|
[RequireComponent(typeof(HighlightEffect))]
|
|
public class ToolsPackGameObjectComponent : MonoBehaviour
|
|
{
|
|
private HighlightEffect _highlight;
|
|
private int index;
|
|
[SerializeField] private ModelTypeEnum _modelTypeEnum;
|
|
[SerializeField] private ToolsPackScene _toolsPackScene;
|
|
[SerializeField] private bool IsClick = true;
|
|
|
|
private void Awake()
|
|
{
|
|
_highlight = this.GetComponent<HighlightEffect>();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
// _toolsPackScene = MotionEngine.GetModule<ToolsPackManager>().GetToolsPackScene();
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
_highlight.highlighted = false;
|
|
}
|
|
|
|
private void OnMouseDown()
|
|
{
|
|
if (EventSystem.current.IsPointerOverGameObject())
|
|
{
|
|
return;
|
|
}
|
|
|
|
|
|
if ( MotionEngine.GetModule<ToolsPackManager>().GetToolsPackScene() == ToolsPackScene.工具间)
|
|
{
|
|
MotionEngine.GetModule<AnimationProcessManager>().HandleClick(this.gameObject.name);
|
|
if (IsClick)
|
|
MotionEngine.GetModule<ToolsPackManager>().AddToolsPack(this.name, this.gameObject);
|
|
this.gameObject.SetActive(false);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void OnMouseEnter()
|
|
{
|
|
if (EventSystem.current.IsPointerOverGameObject())
|
|
{
|
|
return;
|
|
}
|
|
|
|
_highlight.highlighted = true;
|
|
}
|
|
|
|
private void OnMouseExit()
|
|
{
|
|
if (EventSystem.current.IsPointerOverGameObject())
|
|
{
|
|
return;
|
|
}
|
|
|
|
_highlight.highlighted = false;
|
|
}
|
|
|
|
public void SetIndex(int inde)
|
|
{
|
|
index = inde;
|
|
}
|
|
|
|
public int GetIndex()
|
|
{
|
|
return index;
|
|
}
|
|
|
|
// public void SetModelTypeEnum(ModelTypeEnum mo)
|
|
// {
|
|
// _modelTypeEnum = mo;
|
|
// }
|
|
|
|
public ModelTypeEnum GetModelTypeEnum()
|
|
{
|
|
return _modelTypeEnum;
|
|
}
|
|
}
|
|
} |