Esempio n. 1
0
 void Update()
 {
     if (Input.touchCount > 0)
     {
         Touch      toque = Input.touches[0];
         Vector2    virtualBlockPosition = BlockController.BlockPositionFromWorld(Camera.main.ScreenToWorldPoint(toque.position));
         Collider2D collider             = Physics2D.OverlapBox(virtualBlockPosition + (Vector2.one / 2f), Vector2.one * 0.95f, 0, mask);
         if (collider == null)
         {
             PutBlock(virtualBlockPosition);
         }
     }
     else if (Input.GetMouseButton(0))
     {
         Vector2    virtualBlockPosition = BlockController.BlockPositionFromWorld(Camera.main.ScreenToWorldPoint(Input.mousePosition));
         Collider2D collider             = Physics2D.OverlapBox(virtualBlockPosition + (Vector2.one / 2f), Vector2.one * 0.95f, 0, mask);
         if (collider == null)
         {
             PutBlock(virtualBlockPosition);
         }
     }
 }