Example #1
0
    void Update()
    {
        if (activated && Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
        {
            if (!GamePause.isPaused() && isExtraWindowsDisabled())
            {
                touchPos = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);

                if (toRotate())
                {
                    blocks.getBlock().GetComponent <Block>().rotate();
                }
                else if (toMoveDown())
                {
                    blocks.getBlock().GetComponent <Block>().speedUp = true;
                }
                else if (toTurnLeft())
                {
                    blocks.getBlock().GetComponent <Block>().turnLeft();
                }
                else
                {
                    blocks.getBlock().GetComponent <Block>().turnRight();
                }
            }
            else
            {
                GamePause.deactivateAnimated();
            }
        }
    }
Example #2
0
 private void swipeHorizontal()
 {
     if (touchEndPos.x > touchStartPos.x)
     {
         blocks.getBlock().GetComponent <Block>().turnRight();
     }
     else
     {
         blocks.getBlock().GetComponent <Block>().turnLeft();
     }
 }
Example #3
0
 public void moveLeft()
 {
     if (!GamePause.isPaused() && !endgame.isActive())
     {
         blocks.getBlock().GetComponent <Block>().turnLeft();
     }
     else if (GamePause.isPaused() && !endgame.isActive())
     {
         GamePause.deactivateAnimated();
     }
 }