EnemyLogic.OnTriggerEnter C# (CSharp) Method

OnTriggerEnter() public method

public OnTriggerEnter ( Collider theCollision ) : void
theCollision Collider
return void
    void OnTriggerEnter(Collider theCollision)
    {
        //Debug.Log("An enemy got hit");

        //if (theCollision.gameObject.name == "Ship")
        if (theCollision.gameObject.tag == "Player")
        {
            if (dieUponCollision)
            {
                Die();
                PlayerLogic player = (PlayerLogic)theCollision.gameObject.GetComponent(typeof(PlayerLogic));
                player.doDamage(50);
            }
            else
            {
                PlayerLogic player = (PlayerLogic)theCollision.gameObject.GetComponent(typeof(PlayerLogic));
                player.doDamage(player.currentHealth);
            }
            //Debug.Log("You crashed!");
        }
        else if (theCollision.gameObject.tag == "Destroy" && this.gameObject.tag == "Enemy")
        {
            Debug.Log("EnemyLogic: collision with a Destroy object and hasSpawned is " + hasSpawned);
            if (!hasSpawned)
            {
                //Debug.Log ("HAS SPWANED ENEMY");
                hasSpawned = true;
            }
            else
            {
                Debug.Log("ENEMY DESTROYED");
                Destroy(this.gameObject);
            }
        }
    }