void OnTriggerEnter2D(Collider2D other)
 {
     if (CurrentState != null)
     {
         CurrentState.OnTriggerEnter(other);
     }
 }
Example #2
0
    //Is called when this object triggers a collision
    public override void OnTriggerEnter2D(Collider2D other)
    {
        //Enemies Don't take damage from other enemies
        if (other.tag != "EnemyDamage")
        {
            //Tell parent about collision
            base.OnTriggerEnter2D(other);

            //Tells the current state that there was a collision with an object
            currentAIState.OnTriggerEnter(other);
        }
    }