public virtual void TakeDamage(float damage)
    {
        ////////////////////////////////////////////////////////////

        if (player == null)
        {
            Debug.LogError("Player is null ");
            return;
        }
        if (enemyHitEffects == null)
        {
            Debug.LogError("Hiteffects is null ");
            return;
        }
        if (levelManager == null)
        {
            Debug.LogError("levelManager is null ");
            return;
        }

        health -= damage;
        player.RefillHealth(lifestealPercentage * damage);
        AlertRoom();

        // "Spawn" hit effect
        EnemyHitEffect hitEffect = enemyHitEffects.GetEffect().GetComponent <EnemyHitEffect>();

        hitEffect.Play(transform);
        hitSound.start();

        if (health <= 0.0f)
        {
            deadSound.start();

            ////////////////////////////////////////////////////////////
            // CHANGE MATERIALS TO DISSOLVE
            ////////////////////////////////////////////////////////////
            // Materials returned by renderer is a copy, not a reference

            if (materialParents.Count != 0)
            {
                int materialParentIndex = 0;
                int deathMaterialIndex  = 0;
                try
                {
                    foreach (GameObject materialParent in materialParents)
                    {
                        Material[] materials = new Material[originalMaterials[materialParentIndex].Length];
                        for (int materialIndex = 0; materialIndex < originalMaterials[materialParentIndex].Length; materialIndex++)
                        {
                            Texture originalTexture = originalMaterials[materialParentIndex][materialIndex].GetTexture("_BaseColorMap");
                            if (originalTexture == null)
                            {
                                Debug.LogError("Error: Enemy original texture is null. GO: " + gameObject.name);
                                navAgent.enabled = false;
                                gameManager.KillEnemy();
                                Destroy(gameObject);
                                break;
                            }

                            materials[materialIndex] = deathMaterials[deathMaterialIndex];
                            materials[materialIndex].SetTexture("_DissolveAlbedo", originalTexture);
                            deathMaterialIndex++;
                        }

                        materialParents[materialParentIndex].GetComponent <Renderer>().materials = materials;
                        isDissolving = true;
                        disappearsSound.start();
                        materialParentIndex++;
                    }
                }
                catch
                {
                    Debug.LogError("Error: Enemy dissolve fail. GO: " + gameObject.name);
                    navAgent.enabled = false;
                    gameManager.KillEnemy();
                    Destroy(gameObject);
                }
            }
            else
            {
                Debug.LogError("Error: No material parents on enemy. GO: " + gameObject.name);
                navAgent.enabled = false;
                gameManager.KillEnemy();
                Destroy(gameObject);
            }

            ////////////////////////////////////////////////////////////
            // PROPERLY KILL ENEMY FROM GAME
            ////////////////////////////////////////////////////////////

            navAgent.enabled = false;
            foreach (Collider collider in colliders)
            {
                collider.enabled = false;
            }
            gameManager.KillEnemy();

            ////////////////////////////////////////////////////////////
        }

        ////////////////////////////////////////////////////////////

        else
        {
            //StartCoroutine( FlashColor() );
        }

        ////////////////////////////////////////////////////////////
    }