/// <summary>
    /// Inflicts damage to the character.
    /// </summary>
    /// <param name="dmg">Points of damage to inflict.</param>
    public void Damage(int dmg)
    {
        //Defense calculations go here
        dmg -= stats.Defense;

        if (dmg > 0)
        {
            // Player hit state
            if (controller)
            {
                controller.Hurt();
            }

            // add enemy hit state

            stats.HP -= dmg;

            if (stats.HP <= 0)
            {
                animator.SetBool("Alive", false);

                if (controller)
                {
                    controller.alive = false;
                }

                if (enemyController)
                {
                    enemyController.alive = false;
                    enemyController.transform.GetChild(0).gameObject.SetActive(false);
                    enemyController.transform.GetChild(1).gameObject.SetActive(false);

                    // Spawn drops
                    if (coin && alive)
                    {
                        int numcoins = Random.Range(1, 3);

                        for (int i = 0; i < numcoins; i++)
                        {
                            Instantiate(coin, this.transform.position, this.transform.rotation);
                        }
                    }

                    if (hhPickup && alive)
                    {
                        int spawnHH = Random.Range(0, 100);

                        if (spawnHH % 5 == 0)
                        {
                            Instantiate(hhPickup, this.transform.position, this.transform.rotation);
                        }
                    }

                    alive        = false;
                    this.enabled = false;
                }

                if (gunnerController)
                {
                    gunnerController.activated = true;

                    // Spawn drops
                    if (coin && alive)
                    {
                        int numcoins = Random.Range(1, 3);

                        for (int i = 0; i < numcoins; i++)
                        {
                            Instantiate(coin, this.transform.position, this.transform.rotation);
                        }
                    }

                    if (hhPickup && alive)
                    {
                        int spawnHH = Random.Range(0, 100);

                        if (spawnHH % 5 == 0)
                        {
                            Instantiate(hhPickup, this.transform.position, this.transform.rotation);
                        }
                    }

                    alive        = false;
                    this.enabled = false;
                }
            }
            else
            {
                StartCoroutine(Flasher());
            }
        }
        else
        {
            print("0 dmg");
        }
    }