示例#1
0
    private void Update()
    {
        if (!BallsInSceneManager.isThereAnyBallInScene())
        {
            canMove = false; GetCollider.enabled = false;
        }
        else
        {
            GetCollider.enabled = true; canMove = true;
        }


        if (canMove)
        {
            RaycastHit2D raycastHit2D = Physics2D.Raycast(new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x,
                                                                      Camera.main.ScreenToWorldPoint(Input.mousePosition).y), Vector2.zero, 0f);
            if (raycastHit2D)
            {
                if (raycastHit2D.collider.CompareTag("MachineCollider"))
                {
                    screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.localPosition);

                    offset = gameObject.transform.localPosition - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));

                    GetMachineCollider.Move(screenPoint, offset);
                }
            }
        }
    }
示例#2
0
 private void Update()
 {
     if (!BallsInSceneManager.isThereAnyBallInScene() && destroyedAllGifts)
     {
         destroyAllGifts();
     }
     else
     {
         destroyedAllGifts = true;
     }
 }
示例#3
0
    void Update()
    {
        if (!BallsInSceneManager.isThereAnyBallInScene())
        {
            ShootingWithArrow = true;
            ArrowToAim.ShowArrow(ShootingWithArrow);
            if (RemainBalls <= 0 && !gameOver)
            {
                gameOver = true;
                GameController.GameOver();
            }
        }


        if (Input.GetMouseButtonUp(0) && ShootingWithArrow && RemainBalls > 0)
        {
            currentBall = creatBall();
            RemainBalls--;
            currentBall.Shoot(ArrowToAim.transform);
            ShootingWithArrow = false;
            ArrowToAim.ShowArrow(ShootingWithArrow);
            GetBasketManager.NumberOfBallToShow(RemainBalls);
        }
    }