92 lines
2.0 KiB
C#
92 lines
2.0 KiB
C#
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);
|
||
}
|
||
|
||
|
||
|
||
}
|