Exemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.name == "EnemyTriangle(Clone)")
        {
            Destroy(collision.gameObject);
            enemyManagement.enemyTriangleCount--;
        }
        else if (collision.gameObject.name == "EnemyOctagonPurple(Clone)")
        {
            Destroy(collision.gameObject);
            enemyManagement.enemyOctagonPurpleCount--;
        }
        else if (collision.gameObject.name == "EnemyHeartPink(Clone)")
        {
            Destroy(collision.gameObject);
            enemyManagement.enemyHeartPinkCount--;
        }
        else if (collision.gameObject.name == "EnemyCircleMaroon(Clone)")
        {
            Destroy(collision.gameObject);
            enemyManagement.enemyCircleMaroonCount--;
        }

        EnemyBullet enemyBullet = collision.GetComponent <EnemyBullet>();

        if (enemyBullet != null)
        {
            enemyBullet.DestroyBullet();
        }
    }
Exemplo n.º 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        EnemyTriangle enemyTriangle = collision.GetComponent <EnemyTriangle>();

        if (enemyTriangle != null)
        {
            enemyTriangle.killEnemyTriangle();
            gameData.scoreUpdate(enemyTriangle.pointValue);
            enemyManagement.enemyTriangleCount--;
            return;
        }

        //Oxtagon doesn't exist

        /*
         * EnemyOctagonPurple enemyOxtagonPurple = collision.GetComponent<EnemyOctagonPurple>();
         * if (enemyOxtagonPurple != null)
         * {
         *  gameData.scoreUpdate(enemyOxtagonPurple.pointValue);
         *  enemyOxtagonPurple.killEnemyOxtagonPurple();
         *  enemyManagement.enemyOctagonPurpleCount--;
         *  return;
         * }
         */

        EnemyHeartPink enemyHeartPink = collision.GetComponent <EnemyHeartPink>();

        if (enemyHeartPink != null)
        {
            gameData.scoreUpdate(enemyHeartPink.pointValue);
            enemyHeartPink.killEnemy();
            enemyManagement.enemyHeartPinkCount--;
            return;
        }

        EnemyCircleMaroon enemyCircleMaroon = collision.GetComponent <EnemyCircleMaroon>();

        if (enemyCircleMaroon != null)
        {
            gameData.scoreUpdate(enemyCircleMaroon.pointValue);
            enemyCircleMaroon.killEnemy();
            enemyManagement.enemyCircleMaroonCount--;
            return;
        }

        EnemyOctagonPurple enemyOctagonPurple = collision.GetComponent <EnemyOctagonPurple>();

        if (enemyOctagonPurple != null)
        {
            enemyOctagonPurple.killEnemy();
            gameData.scoreUpdate(2);
        }

        EnemyBullet enemyBullet = collision.GetComponent <EnemyBullet>();

        if (enemyBullet != null)
        {
            enemyBullet.DestroyBullet();
        }
    }
Exemplo n.º 3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.name == "EnemyTriangle(Clone)")
        {
            hitSource.Play();
            score.scoreUpdate(1);
            Destroy(collision.gameObject);
            health.updateCoreHealth(5);
            enemyManagement.enemyTriangleCount--;
        }
        else if (collision.gameObject.name == "EnemyOctagonPurple(Clone)")
        {
            hitSource.Play();
            score.scoreUpdate(2);
            Destroy(collision.gameObject);
            health.updateCoreHealth(20);
            enemyManagement.enemyOctagonPurpleCount--;
        }
        else if (collision.gameObject.name == "EnemyHeartPink(Clone)")
        {
            hitSource.Play();
            score.scoreUpdate(3);
            Destroy(collision.gameObject);
            health.updateCoreHealth(20);
            enemyManagement.enemyHeartPinkCount--;
        }
        else if (collision.gameObject.name == "EnemyCircleMaroon(Clone)")
        {
            hitSource.Play();
            EnemyCircleMaroon enemy = collision.GetComponent <EnemyCircleMaroon>();
            score.scoreUpdate(enemy.pointValue);
            Destroy(collision.gameObject);
            health.updateCoreHealth(25);
            enemyManagement.enemyCircleMaroonCount--;
        }

        EnemyBullet enemyBullet = collision.GetComponent <EnemyBullet>();

        if (enemyBullet != null)
        {
            hitSource.Play();
            health.updateCoreHealth(5);
            enemyBullet.DestroyBullet();
        }
    }