using System;
using UnityEngine;
namespace UnityEditor.U2D.Path.GUIFramework
{
///
/// Represents an action that is tied to a Control.
///
public abstract class HoveredControlAction : GUIAction
{
private Control m_HoveredControl;
///
/// The hovered control.
///
public Control hoveredControl
{
get { return m_HoveredControl; }
}
///
/// Initializes and returns an instance of HoverControlAction.
///
/// The control to execcute an action for on hover.
public HoveredControlAction(Control control)
{
m_HoveredControl = control;
}
///
/// Determines whether the HoveredControlAction can trigger.
///
/// The current state of the custom editor.
/// Returns `true` if the HoveredControlAction can trigger. Otherwise, returns `false`.
protected override bool CanTrigger(IGUIState guiState)
{
return guiState.nearestControl == hoveredControl.ID;
}
///
/// Calls the methods in its invocation list when triggered.
///
/// The current state of the custom editor.
protected override void OnTrigger(IGUIState guiState)
{
m_HoveredControl.SetActionID(ID);
}
}
}