Exemplo n.º 1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.name == "Objective")
        {
            collision.gameObject.GetComponent <ObjectiveHealth>().HitObjective(100);
            Destroy(gameObject);
        }
        else if (collision.gameObject.tag.Equals("Bullet"))
        {
            BulletType bulletType = collision.gameObject.GetComponent <BulletType>();

            enemyHealth -= bulletType.BulletDamage;

            bulletType.GetComponent <Collider>().enabled = false;
            if (enemyHealth <= 0)
            {
                GUIManager.GUIManager_Instance.goldCount       += 25;
                GUIManager.GUIManager_Instance.experienceCount += 25;
                GUIManager.GUIManager_Instance.UpdateExperience();
                GUIManager.GUIManager_Instance.UpdateGold();
                Destroy(gameObject);
            }
        }
    }