This file contains 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
public class DiscordRunner:MonoBehaviour | |
{ | |
private const long CLIENT_ID = ...; | |
private static DiscordRunner s_Instance; | |
public static void Initialize() | |
{ | |
#if !DISABLEDISCORD | |
s_Instance = new GameObject("[Discord runner]").AddComponent<DiscordRunner>(); |
This file contains 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
private Collider2D[] m_Hits=new Collider2D[16]; // 16 may not be enough for everyone. | |
private T GetTargetObject<T>(Vector3 mousePosition) where T:Component | |
{ | |
var ray = Camera.main.ScreenPointToRay(mousePosition); | |
var pos = ray.GetPoint(-ray.origin.z/ray.direction.z); | |
var max = Physics2D.OverlapPointNonAlloc(pos, m_Hits); | |
for (int ii = 0; ii < max; ii++) | |
{ | |
var hit = m_Hits[ii]; |
This file contains 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; | |
public class MouseEventSender : MonoBehaviour | |
{ | |
public float RayCastDistance = float.MaxValue; | |
public LayerMask LayerMask; | |
public Camera Camera; | |
public int Button; | |
private Collider m_LastHit; |
This file contains 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
class Timer : IDisposable | |
{ | |
private readonly string m_Text; | |
private Stopwatch m_Stopwatch; | |
public Timer(string text) | |
{ | |
m_Text = text; | |
m_Stopwatch = Stopwatch.StartNew(); | |
} |