示例#1
0
文件: TapInput.cs 项目: GamingDF/ISA
 void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     else
     {
         Debug.LogWarning("Duplicate of singleton, destroying: " + gameObject.name);
         Destroy(gameObject);
     }
 }
示例#2
0
        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);
                }
            }
        }