66 lines
1.5 KiB
C#
66 lines
1.5 KiB
C#
using System;
|
|
using DefaultNamespace;
|
|
using HighlightPlus;
|
|
using MotionFramework;
|
|
using UnityEngine;
|
|
|
|
namespace ToolsPack
|
|
{
|
|
/// <summary>
|
|
/// 附着在工具模型上
|
|
/// </summary>
|
|
[RequireComponent(typeof(BoxCollider))]
|
|
[RequireComponent(typeof(HighlightEffect))]
|
|
public class ToolsPackGameObjectComponent : MonoBehaviour
|
|
{
|
|
private HighlightEffect _highlight;
|
|
private int index;
|
|
[SerializeField] private ModelTypeEnum _modelTypeEnum;
|
|
|
|
private void Awake()
|
|
{
|
|
_highlight = this.GetComponent<HighlightEffect>();
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
_highlight.highlighted = false;
|
|
}
|
|
|
|
private void OnMouseDown()
|
|
{
|
|
MotionEngine.GetModule<ToolsPackManager>().AddToolsPack(this.name, this.gameObject);
|
|
this.gameObject.SetActive(false);
|
|
}
|
|
|
|
private void OnMouseEnter()
|
|
{
|
|
_highlight.highlighted = true;
|
|
}
|
|
|
|
private void OnMouseExit()
|
|
{
|
|
_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;
|
|
}
|
|
}
|
|
} |