23 lines
519 B
C#
23 lines
519 B
C#
|
using Godot;
|
||
|
using System;
|
||
|
|
||
|
public partial class MouseInput : Node
|
||
|
{
|
||
|
public Action OnMouseDown = null;
|
||
|
public Action OnMouseUp = null;
|
||
|
|
||
|
// Called when the node enters the scene tree for the first time.
|
||
|
public override void _Ready()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||
|
public override void _Process(double delta)
|
||
|
{
|
||
|
if (Input.IsActionJustPressed("Mouse Left"))
|
||
|
OnMouseDown?.Invoke();
|
||
|
if (Input.IsActionJustReleased("Mouse Left"))
|
||
|
OnMouseUp?.Invoke();
|
||
|
}
|
||
|
}
|