IEnumerator AttackCoroutine()
    {
        // the attack has to happen after a delay
        float timer = 0.5f;

        while (true)
        {
            if (!enemy.isPaused)
            {
                timer -= Time.deltaTime;
                Debug.Log(enemy.name + " timer is: " + timer);
            }

            if (timer <= 0)
            {
                break;
            }

            yield return(null);
        }

        if (PlayerInAttackRange())
        {
            //TODO: play an animation
            navi.TakeDamage(damage);
        }
        else
        {
            // crack the panel
            PanelController panelToLeft = battlefield.GetPanelRelativeTo(enemy.panelCurrentlyOn, Direction.left);
            if (panelToLeft != null)
            {
                panelToLeft.ChangeTo(PanelDatabase.instance.GetPanel("Cracked Panel"));
            }
        }

        ResetAttackDelay();
    }