예제 #1
0
    IEnumerator Shoot()
    {
        shootEfect.Play();
        shootGunSound.Play();

        RaycastHit hit;

        if (Physics.Raycast(mainCamera.transform.position, mainCamera.transform.forward, out hit, range))
        {
            BreakableObject breakableObject = hit.transform.GetComponent <BreakableObject>();
            Bomb            bombObj         = hit.transform.GetComponent <Bomb>();

            if (breakableObject != null)
            {
                glassBrokeSound.Play();
                breakableObject.triggerBreak();
                gameContoller.AddScore();
            }
            else if (bombObj != null)
            {
                explosionSound.Play();
                bombObj.triggerBreak();
                bloodCanvas.SetActive(true);
                yield return(new WaitForSeconds(1));

                gameContoller.EndLevel(true);
            }
        }
    }
예제 #2
0
 void OnCollisionEnter(Collision col)
 {
     if (col.gameObject.tag == "Ball")
     {
         bumperAudio.Play();
         gameController.AddScore(reward);
     }
 }
예제 #3
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Boundary")
        {
            return;
        }
        Instantiate(explosion, transform.position, transform.rotation);
        if (other.tag == "Player")
        {
            Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
            gameController.GameOver();
        }

        gameController.AddScore(scoreValue);
        Destroy(other.gameObject);
        Destroy(gameObject);
    }