// Update is called once per frame
    void Update()
    {
        base.Update();
        //();
        if (_navMeshAgent == null)
        {
            Debug.LogError("nav mesh component is not attached");
        }
        else
        {
            SwitchState();
            //GoToCenter();
            if (transform.position.x < -5 || transform.position.z > 37f || transform.position.x > 30f || transform.position.z < 5f)
            {
            }
        }

        if (travelling && _navMeshAgent.isStopped)
        {
            travelling = false;
            SwitchState();
        }

        healthT.text     = "Health: " + Mathf.RoundToInt(health).ToString();
        armorT.text      = "Armor: " + Mathf.RoundToInt(armor).ToString();
        energyT.text     = "Energy: " + Mathf.RoundToInt(energy).ToString();
        metabolismT.text = "Metabolism: " + metabolism.ToString("F2");
        ammoT.text       = "Ammo: " + Mathf.RoundToInt(ammo).ToString();

        healthTT.text     = "Health: " + Mathf.RoundToInt(health).ToString();
        armorTT.text      = "Armor: " + Mathf.RoundToInt(armor).ToString();
        energyTT.text     = "Energy: " + Mathf.RoundToInt(energy).ToString();
        metabolismTT.text = "Metabolism: " + metabolism.ToString("F2");
        ammoTT.text       = "Ammo: " + Mathf.RoundToInt(ammo).ToString();

        if (!alive)
        {
            cameraManager.SwitchCam(0);
            cameraManager.brandonAlive = false;
            audioController.BacteriaDied();
            GameObject tempEplosionFVX = Instantiate(explosionVFX);
            tempEplosionFVX.transform.position = gameObject.transform.position;
            tempEplosionFVX.GetComponentInChildren <ParticleSystem>().Play();
            nameT.color         = Color.red;
            nameTT.color        = Color.red;
            camBtnTxt.color     = Color.red;
            camBtn.interactable = false;
            Destroy(tempEplosionFVX, 02f);
            this.gameObject.SetActive(false);
            //Destroy(gameObject);
        }
    }
    // Update is called once per frame
    protected override void Update()
    {
        base.Update();

        if (navMeshAgent == null)
        {
            Debug.LogError("nav mesh component is not attached");
        }
        else
        {
            DestinationF();
        }

        if (travelling && navMeshAgent.isStopped == true)
        {
            travelling = false;
            DestinationF();
        }

        healthT.text     = "Health: " + Mathf.RoundToInt(health).ToString();
        armorT.text      = "Armor: " + Mathf.RoundToInt(armor).ToString();
        energyT.text     = "Energy: " + Mathf.RoundToInt(energy).ToString();
        metabolismT.text = "Metabolism: " + metabolism.ToString("F2");
        ammoT.text       = "Ammo: " + Mathf.RoundToInt(ammo).ToString();

        healthTT.text     = "Health: " + Mathf.RoundToInt(health).ToString();
        armorTT.text      = "Armor: " + Mathf.RoundToInt(armor).ToString();
        energyTT.text     = "Energy: " + Mathf.RoundToInt(energy).ToString();
        metabolismTT.text = "Metabolism: " + metabolism.ToString("F2");
        ammoTT.text       = "Ammo: " + Mathf.RoundToInt(ammo).ToString();

        if (FoodEnemyWalls == 1)
        {
            StateT.text  = "Searching Food..";
            StateTT.text = "Searching Food..";
        }
        if (FoodEnemyWalls == 2)
        {
            StateT.text  = "Searching Enemies..";
            StateTT.text = "Searching Enemies..";
        }
        if (FoodEnemyWalls == 3)
        {
            StateT.text  = "Avoiding Walls..";
            StateTT.text = "Avoiding Walls..";
        }

        if (!alive)
        {
            cameraManager.SwitchCam(0);
            cameraManager.kaanAlive = false;
            audioController.BacteriaDied();
            GameObject tempEplosionFVX = Instantiate(explosionVFX);
            tempEplosionFVX.transform.position = gameObject.transform.position;
            tempEplosionFVX.GetComponentInChildren <ParticleSystem>().Play();
            nameT.color         = Color.red;
            nameTT.color        = Color.red;
            camBtnTxt.color     = Color.red;
            camBtn.interactable = false;
            Destroy(tempEplosionFVX, 02f);
            this.gameObject.SetActive(false);
            //Destroy(gameObject);
        }
    }
    protected override void Update()
    {
        base.Update();

        if (navMeshAgent == null)
        {
            Debug.LogError("nav mesh component is not attached");
        }
        else
        {
            NextAction();
        }

        // Sounds like this could've been solved with an IEnumerator or a "do: while" loop
        if (travelling && navMeshAgent.isStopped == true)
        {
            travelling = false;
            NextAction();
        }
        // Isn't it possible that it's still not set after this if has run? That's why I suggested a do: while loop

        // This rounds up and down, you could've just casted to an int
        // (by using ((int)Mathf.RoundToInt(health)).ToString(), but yeah that's less readable)
        // Main Camera UI Text Updates
        healthT.text     = "Health: " + Mathf.RoundToInt(health).ToString();
        armorT.text      = "Armor: " + Mathf.RoundToInt(armor).ToString();
        energyT.text     = "Energy: " + Mathf.RoundToInt(energy).ToString();
        metabolismT.text = "Metabolism: " + metabolism.ToString("F2"); //
        ammoT.text       = "Ammo: " + Mathf.RoundToInt(ammo).ToString();

        // Player Camera UI Text Updates
        healthTT.text     = "Health: " + Mathf.RoundToInt(health).ToString();
        armorTT.text      = "Armor: " + Mathf.RoundToInt(armor).ToString();
        energyTT.text     = "Energy: " + Mathf.RoundToInt(energy).ToString();
        metabolismTT.text = "Metabolism: " + metabolism.ToString("F2");
        ammoTT.text       = "Ammo: " + Mathf.RoundToInt(ammo).ToString();

        // Please use an enum instead of numbers, it's more readable and for the computer it's still like using numbers
        // UI Current State Update
        if (currentState == 1)
        {
            StateT.text  = "Searching Food..";
            StateTT.text = "Searching Food..";
        }
        if (currentState == 2)
        {
            StateT.text  = "Searching Enemies..";
            StateTT.text = "Searching Enemies..";
        }
        if (currentState == 3)
        {
            StateT.text  = "Avoiding Walls..";
            StateTT.text = "Avoiding Walls..";
        }

        // On Bacteria Death
        if (!alive)
        {
            cameraManager.janiAlive = false;
            // What if another camera was active? Aren't you overriding that camera then?
            cameraManager.SwitchCam(0); // Switch to Main Camera

            // UI Update & Disable Player Camera Button
            nameT.color         = Color.red;
            nameTT.color        = Color.red;
            camBtnTxt.color     = Color.red;
            camBtn.interactable = false;

            audioController.BacteriaDied(); // Play Death Sound FX

            // You can just spawn the actual ParticleSystem if you use that as an Type instead (ParticleSystem explosionVFX). Instantiate is a generic function.
            // Play Death Particle FX
            GameObject tempEplosionFVX = Instantiate(explosionVFX);
            tempEplosionFVX.transform.position = gameObject.transform.position;
            tempEplosionFVX.GetComponentInChildren <ParticleSystem>().Play();
            Destroy(tempEplosionFVX, 02f);


            // This keyword is superfluous, that's why it's "greyed out". It's a reference to the instance of the object, it's like me telling you who you are. You already know that!
            this.gameObject.SetActive(false); // Disable Game Object
        }
    }