예제 #1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "DestroyAreaL")
        {
            Debug.Log("left");
            scr.addScore(2);
            Instantiate(ballGenerate, new Vector3(5, 4.970479f, 0), Quaternion.Euler(270, 0, 0));
            Destroy(this.gameObject);

            //scoreScript scr = (scoreScript) gameman.GetComponent(typeof(scoreScript));
        }
        else if (other.gameObject.tag == "DestroyAreaR")
        {
            Debug.Log("right");
            scr.addScore(1);
            Instantiate(ballGenerate, new Vector3(-5, 4.970479f, 0), Quaternion.Euler(270, 0, 0));
            Destroy(this.gameObject);
        }

        else
        {
            GetComponent <AudioSource>().Play();
        }
    }
예제 #2
0
    void Die()
    {
        Instantiate(deathParticles, transform.position, deathParticles.transform.rotation);
        Instantiate(scoreParticle, transform.position, scoreParticle.transform.rotation);


        if (gameObject.name == "fatEnemy")
        {
            spawner.curAmount -= 1;
        }

        //death sound here
        deathSound.Play();

        scoreScript.addScore(scoreValue);
        Destroy(gameObject);
    }