MiniGames/Assets/JumpHoldImage.cs

20 lines
478 B
C#
Raw Normal View History

using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
[RequireComponent(typeof(Image))]
public class JumpHoldImage : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
public ChasePlayerController player;
public void OnPointerDown(PointerEventData eventData)
{
if (player != null) player.OnJumpPress();
}
public void OnPointerUp(PointerEventData eventData)
{
if (player != null) player.OnJumpRelease();
}
}