void OnMouseDown()
    {
        NumOfClick += 1f;

        if (gameObject.name.Equals("Virus(Clone)"))
        {
            GameObject VirusExplosion = Instantiate(explosionVirus, transform.position, transform.rotation) as GameObject;
            Destroy(this.gameObject);
            Destroy(VirusExplosion, 0.407f);
            healthControl.IncreaseLife();
            voice.VirusVoice();
        }


        else if (NumOfClick == 2f)
        {
            GameObject BigVirusExplosion = Instantiate(explosionVirus, transform.position, transform.rotation) as GameObject;
            Destroy(this.gameObject);
            Destroy(BigVirusExplosion, 0.407f);
            healthControl.BigVirusIncreaseLife();
            voice.VirusVoice();
        }

        if (gameObject.name.Equals("redblood(Clone)"))
        {
            GameObject RedBloodExplosion = Instantiate(explosionRedBlood, transform.position, transform.rotation) as GameObject;
            Destroy(this.gameObject);
            Destroy(RedBloodExplosion, 0.413f);
            healthControl.DecreaseLife();
            voice.RedBloodVoice();
        }
    }
Beispiel #2
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.name.Equals("Border"))
        {
            Destroy(this.gameObject);

            if (this.gameObject.name.Equals("Virus(Clone)"))
            {
                healthControl.DecreaseLife();
            }

            if (this.gameObject.name.Equals("BigVirus(Clone)"))
            {
                healthControl.BigVirusDecreaseLife();
            }
        }
    }