Example #1
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Vector3 targetPosition = GetTargetPosition(Input.mousePosition);
            float   throwingAngle  = Input.mousePosition.y / Screen.height * 50f;

            Throwing(targetPosition, throwingAngle);
            ballCounter.DecreaseBallCount(1);
        }
    }
Example #2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Goal"))
        {
            Debug.Log("Goal");
        }

        if (other.gameObject.CompareTag("Obstacle"))
        {
            alertAnimator.SetTrigger("Alert");

            //何回もぶつかるのを防ぐため障害物の幅だけ進ませる
            transform.position += Vector3.forward * other.transform.localScale.z;
            StartCoroutine("CameraShake");

            ballCounter.DecreaseBallCount(5);
        }
    }