YanCheng_Metrology/Assets/Scripts/Project/Objects/Other/PermanentTriggerBase.cs

92 lines
2.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HighlightPlus;
using UnityEngine.EventSystems;
/// <summary>
/// ³£×¤½»»¥
/// </summary>
public class PermanentTriggerBase : MonoBehaviour
{
public int triggerID;
public string triggerName;
public HighlightEffect _highlight;
private void Awake()
{
OnAwake();
}
private void Start()
{
OnStart();
}
private void SwitchSubProcessStepTriggerID(int arg0)
{
if (triggerID == arg0)
{
_highlight.SetHighlighted(true);
Debug.Log("PermanentTriggerBaseÎÒÓ¦¸ÃÌáʾ");
}
else
{
_highlight.SetHighlighted(false);
}
}
/// <summary>
/// Awake
/// </summary>
protected virtual void OnAwake()
{
_highlight = GetComponent<HighlightEffect>();
}
/// <summary>
/// Start
/// </summary>
protected virtual void OnStart()
{
GameManager.EventMgr.AddEventListener<int>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
}
private void OnMouseEnter()
{
if (EventSystem.current.IsPointerOverGameObject()) return;
OnMEnter();
}
private void OnMouseDown()
{
if (EventSystem.current.IsPointerOverGameObject()) return;
OnMDown();
}
private void OnMouseExit()
{
if (EventSystem.current.IsPointerOverGameObject()) return;
OnMExit();
}
protected virtual void OnMEnter()
{
}
protected virtual void OnMDown()
{
}
protected virtual void OnMExit()
{
}
private void OnDestroy()
{
GameManager.EventMgr.RemoveEventListener<int>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
}
private void OnDisable()
{
GameManager.EventMgr.RemoveEventListener<int>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
}
}