Example #1
0
    void OnTriggerEnter2D(Collider2D otherCollider)
    {
        Shot shot = otherCollider.gameObject.GetComponent <Shot>();

        if (shot != null)
        {
            if (shot.isEnemyShot != isEnemy)
            {
                ScoreScript.scoreValue += 50;
                Damage(shot.damage);
                Destroy(shot.gameObject);
                Instantiate(Asteroidm, GetComponent <Rigidbody2D>().position, Quaternion.identity);
                Instantiate(Asteroidm2, GetComponent <Rigidbody2D>().position, Quaternion.identity);
            }
        }
        Enemyscr rot = otherCollider.gameObject.GetComponent <Enemyscr>();

        if (rot != null)
        {
            if (rot.isEnemyShot == isEnemy)
            {
                Damage(rot.damage);
            }
        }
    }
Example #2
0
    void OnTriggerEnter2D(Collider2D otherCollider)
    {
        Shot shot = otherCollider.gameObject.GetComponent <Shot>();

        if (shot != null)
        {
            if (shot.isEnemyShot != isEnemy)
            {
                Damage(shot.damage);
                Destroy(shot.gameObject);
            }
        }
        Enemyscr rot = otherCollider.gameObject.GetComponent <Enemyscr>();

        if (rot != null)
        {
            if (rot.isEnemyShot == isEnemy)
            {
                Damage(rot.damage);
            }
        }
    }