Manual

Touch Detector

Code examples to perform various interactions with the Touch Detector

Init

Initialize the TouchDetector

using Doozy.Engine.Touchy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    private void Start()
    {
        TouchDetector.Init();        
    }
}

Get Cardinal Direction

Get the Vector2 representation of the given Swipe direction

using Doozy.Engine.Touchy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public Swipe SwipeDirection;
    
    private void Start()
    {
        Vector2 direction = TouchDetector.GetCardinalDirection(SwipeDirection);
    }
}

Get Swipe

Convert a SimpleSwipe into a Swipe

using Doozy.Engine.Touchy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public SimpleSwipe SimpleSwipeDirection;
    
    private void Start()
    {
        Swipe swipeDirection = TouchDetector.GetSwipe(SimpleSwipeDirection);
    }
}

Get SimpleSwipe

Convert a Swipe into a SimpleSwipe

using Doozy.Engine.Touchy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public Swipe SwipeDirection;
    
    private void Start()
    {
        SimpleSwipe simpleSwipeDirection = TouchDetector.GetSimpleSwipe(SwipeDirection);
    }
}

Get Swipe Direction

Get a Swipe direction by analyzing a given direction

using Doozy.Engine.Touchy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public Vector2 Direction;
    
    private void Start()
    {
        Swipe swipeDirection = TouchDetector.GetSwipeDirection(Direction);
    }
}

Get SimpleSwipe Direction

Get a SimpleSwipe direction by analyzing a given direction

using Doozy.Engine.Touchy;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public Vector2 Direction;
    
    private void Start()
    {
        SimpleSwipe simpleSwipeDirection = TouchDetector.GetSimpleSwipeDirection(Direction);
    }
}