This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.EventSystems; | |
public static class IsPointerOverUI { | |
public static bool Check() { | |
if (EventSystem.current == null) return false; | |
PointerEventData eventDataCurrentPosition = new PointerEventData(EventSystem.current); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public static class CantorPairUtility { | |
public static int CantorPair(int x, int y) { | |
return (((x + y) * (x + y + 1)) / 2) + y; | |
} | |
public static void ReverseCantorPair(int cantor, out int x, out int y) { | |
var t = (int) Math.Floor((-1 + Math.Sqrt(1 + 8 * cantor)) / 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System; | |
using System.Collections.Generic; | |
using UnityEngine.EventSystems; | |
/// <summary> A modular and easily customisable Unity MonoBehaviour for handling swipe and pinch motions on mobile. </summary> | |
public class PanAndZoom : MonoBehaviour { | |
/// <summary> Called as soon as the player touches the screen. The argument is the screen position. </summary> | |
public event Action<Vector2> onStartTouch; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using UnityEngine; | |
using UnityEngine.UI; | |
[ExecuteInEditMode] | |
public class RoundRectGraphic : Graphic { | |
[Range(0, 200)] | |
public int radius; | |
public bool hasTop; |