//-----------------------------------determinePhase--------------------------------------
 //Determines the phase the enemy is in at the moment
 private void determinePhase()
 {
     if (_distanceToPlayer < detectRadius && _distanceToPlayer > chaseRadius)
     {
         enemyPhaseCurrent = ENEMYPHASE.ALERT;
     }
     else if (_distanceToPlayer < combatRadius && !enemy.isDying)
     {
         enemyPhaseCurrent = ENEMYPHASE.COMBAT;
     }
     else if (_distanceToPlayer < chaseRadius)
     {
         enemyPhaseCurrent = ENEMYPHASE.CHASE;
     }
     else
     {
         enemyPhaseCurrent = ENEMYPHASE.PATROL;
     }
 }
    private void FixedUpdate()
    {
        determineDistanceToPlayer();
        determinePlayerSpeed();

        enemyPhasePrevious = enemyPhaseCurrent;
        determinePhase();


        if (enemyPhasePrevious != enemyPhaseCurrent)
        {
            switch (enemyPhaseCurrent)
            {
            case ENEMYPHASE.ALERT:
                sound.playSound(1);
                chasePlayer.enabled = false;
                moveTrail.enabled   = false;
                break;

            case ENEMYPHASE.COMBAT:
                //Necessary value switches
                Player playerStats = _player.GetComponent <Player>();
                enemy.inCombat = true;
                playerStats.SetEnemy(gameObject);
                playerStats.isEnteringCombat = true;

                chasePlayer.enabled = false;
                moveTrail.enabled   = false;
                foreach (GameObject enemy in _enemies)
                {
                    if (enemy != null)
                    {
                        if (enemy.GetComponent <DetermineEnemyMovePhaseFaweedEditon>())
                        {
                            DetermineEnemyMovePhaseFaweedEditon phase = enemy.GetComponent <DetermineEnemyMovePhaseFaweedEditon>();
                            phase.chasePlayer.enabled = false;
                            phase.moveTrail.enabled   = false;
                        }
                    }
                }

                break;

            case ENEMYPHASE.CHASE:
                sound.playSound(2);
                chasePlayer.enabled = true;
                moveTrail.enabled   = false;
                break;

            case ENEMYPHASE.PATROL:
                Debug.Log("HI");
                chasePlayer.enabled = false;
                moveTrail.enabled   = true;
                moveTrail.GoToNextWavePoint();
                break;

            case ENEMYPHASE.PAUSE:
                chasePlayer.enabled = false;
                moveTrail.enabled   = false;
                break;
            }
        }
    }