ShanxiKnowledgeBase/SXElectricityInformationAcq.../Assets/Scripts/ToolsPack/ToolsPackGameObjectComponen...

54 lines
1.2 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;
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;
}
}
}