Update touch input settings
This commit is contained in:
@@ -20,19 +20,48 @@ public class EndlessDescenderController : MonoBehaviour, ITouchInputConsumer
|
||||
isTouchActive = false;
|
||||
}
|
||||
|
||||
public void OnTouchPress(Vector2 worldPosition)
|
||||
// Implement new ITouchInputConsumer contract
|
||||
public void OnTap(Vector2 worldPosition)
|
||||
{
|
||||
// Only update horizontal position
|
||||
// Treat tap as a quick move to the tapped X position
|
||||
targetFingerX = Mathf.Clamp(worldPosition.x, GameManager.Instance.EndlessDescenderClampXMin, GameManager.Instance.EndlessDescenderClampXMax);
|
||||
isTouchActive = true;
|
||||
}
|
||||
|
||||
public void OnTouchPosition(Vector2 worldPosition)
|
||||
public void OnDragStart(Vector2 position)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public void OnDrag(Vector2 position)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public void OnDragEnd(Vector2 position)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public void OnHoldStart(Vector2 worldPosition)
|
||||
{
|
||||
// Start hold, update target X
|
||||
targetFingerX = Mathf.Clamp(worldPosition.x, GameManager.Instance.EndlessDescenderClampXMin, GameManager.Instance.EndlessDescenderClampXMax);
|
||||
isTouchActive = true;
|
||||
}
|
||||
|
||||
public void OnHold(Vector2 worldPosition)
|
||||
{
|
||||
// Update target x as finger moves
|
||||
targetFingerX = Mathf.Clamp(worldPosition.x, GameManager.Instance.EndlessDescenderClampXMin, GameManager.Instance.EndlessDescenderClampXMax);
|
||||
}
|
||||
|
||||
public void OnHoldEnd(Vector2 worldPosition)
|
||||
{
|
||||
// Stop hold
|
||||
isTouchActive = false;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (!isTouchActive) return;
|
||||
|
||||
Reference in New Issue
Block a user