namespace EventSystem.Framework.FunctionEvents
{
/// Used to handle mouse interactions with button clicks and scrolling the mouse wheel.
public class MouseButtonEvents
{
/// Function that runs when the user left clicks.
public functionEvent onLeftClick;
/// Function that runs when the user right clicks.
public functionEvent onRightClick;
/// Function that runs when the user scrolls the mouse wheel.
public functionEvent onMouseScroll;
/// A constructor used to set a single function to a mouse button.
///
/// If true the function is set to the left click. If false the function is set to the right click.
public MouseButtonEvents(functionEvent clickFunction, bool leftClick)
{
if (leftClick) this.onLeftClick = clickFunction;
else this.onRightClick = clickFunction;
}
/// A constructor used to map functions to mouse clicks.
/// A function to be ran when the mouse left clicks this position.
/// A function to be ran when the mouse right clicks this position.
public MouseButtonEvents(functionEvent OnLeftClick, functionEvent OnRightClick)
{
this.onLeftClick = OnLeftClick;
this.onRightClick = OnRightClick;
}
/// A constructor used to map functions to mouse clicks and scrolling the mouse wheel.
/// A function to be ran when the mouse left clicks this position.
/// A function to be ran when the mouse right clicks this position.
/// A function to be ran when the user scrolls the mouse
public MouseButtonEvents(functionEvent OnLeftClick, functionEvent OnRightClick, functionEvent OnMouseScroll)
{
this.onLeftClick = OnLeftClick;
this.onRightClick = OnRightClick;
this.onMouseScroll = OnMouseScroll;
}
}
}