void Awake() { if (_instance == null) { _instance = this; } else { Debug.LogWarning("Duplicate of singleton, destroying: " + gameObject.name); Destroy(gameObject); } }
private void OnTapped(TapInput input) { // Try find tapped target Vector2 worldCurrent = cachedCamera.ScreenToWorldPoint(input.ReleasePosition); // Try find target to grab for this touch Collider2D collider = Physics2D.OverlapPoint(worldCurrent, castLayerMask); if (collider != null) { // Try find a TapTarget object on this hit component var target = collider.GetComponent <TapTarget>(); if (target != null) { // Remember that this swipe went over this object target.Hit((float)input.TimeStamp); } } }