// Update is called once per frame
    void Update()
    {
        if (currentPhase == 0)
        {
            var distance = Vector3.Distance(transform.position, PlayerController.instance.transform.position);
            if (distance <= battleStartRange)
            {
                goToNextPhase();
            }
        }

        if (GameManager.instace.respawning)
        {
            currentPhase = phases.intro;
            anim.animationPhase(0);
            gameObject.SetActive(false);
            robotActivetor.SetActive(true);
            entrace.SetActive(true);
            GameManager.instace.respawning = false;
        }
    }
    // Update is called once per frame
    void Update()
    {
        transform.LookAt(PlayerController.instance.transform, Vector3.up);
        transform.rotation = Quaternion.Euler(0f, transform.rotation.eulerAngles.y, 0f);
        if (isMovingBoss)
        {
            if (!startBattle)
            {
                var distanceToPlayer = Vector3.Distance(transform.position, PlayerController.instance.transform.position);
                if (distanceToPlayer <= attackRange)
                {
                    startBattle  = true;
                    currentPhase = bossPhases.phase1;
                    checkState();
                }
                else
                {
                    transform.position = Vector3.MoveTowards(transform.position, PlayerController.instance.transform.position, moveSpeed * Time.deltaTime);
                }
            }
        }

        if (GameManager.instace.respawning)
        {
            lifeBar.SetActive(false);
            currentPhase = bossPhases.intro;
            anim.animationPhase(0); //intro
            gameEntrace.SetActive(true);
            bossActivator.SetActive(true);
            GameManager.instace.respawning = false;
            startBattle = false;
            gameObject.SetActive(false);
        }
        if (inerme)
        {
            anim.animationPhase(0); //idle
            vulnerableCounter -= Time.deltaTime;
            if (vulnerableCounter <= 0)
            {
                bh.invincible     = true;
                inerme            = false;
                vulnerableCounter = vulnerableTime;
                checkState();
            }
        }
    }