Initial commit
This commit is contained in:
28
Assets/Scripts/SliderReleaseHandler.cs
Normal file
28
Assets/Scripts/SliderReleaseHandler.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SliderReleaseHandler : MonoBehaviour, IPointerUpHandler, IDragHandler
|
||||
{
|
||||
public RewindManager rewindManager;
|
||||
private Slider _slider;
|
||||
private float _lastDragValue;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
_slider = GetComponent<Slider>();
|
||||
_lastDragValue = _slider.value;
|
||||
}
|
||||
|
||||
public void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
_lastDragValue = _slider.value;
|
||||
}
|
||||
|
||||
public void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
rewindManager.OnSliderReleased(_lastDragValue);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user