Exemple #1
0
 private void LateUpdate()
 {
     if (hitpointBar.GetHP() < 1)
     {
         Die();
     }
 }
Exemple #2
0
    public override void Update()
    {
        sword = GameObject.FindGameObjectWithTag("Sword").GetComponent <Sword>();
        projectileFrequency = UnityEngine.Random.Range(1, 7);
        HandleTimers();
        HandleProjectiles();
        if (hitpointBar == null)
        {
            hitpointBar = GameObject.Find("BossLifeBar(Clone)").GetComponent <BossBar>();
        }
        else
        {
            if (hitpointBar.GetHP() < 1)
            {
                Die();
            }
        }

        GetDistanceFromPlayer();

        if (playerHPBar.PlayerHealth <= 0)
        {
            audioSources[2].Stop();
            music.level1 = false;
            Destroy(this);
        }
    }
    public void FightStart()
    {
        hitpointBar = GameObject.Find("BossLifeBar(Clone)").GetComponent <BossBar>();

        if (hitpointBar.GetHP() < 10 && !oneTime)
        {
            TurnIntoDarkMode();
            oneTime = true;
        }
    }
    private void HandleTimers()
    {
        if (!isSpawning())
        {
            if (CheckIfInRange(3))
            {
                // Follow the player
                Vector2 target = player.transform.position - transform.position;
                transform.Translate(target.normalized * speed * Time.deltaTime, Space.World);
            }

            if (hitpointBar.GetHP() < 1)
            {
                Die();
            }
        }
    }