void phase1() { // check boss phase 2 if (bossManager.checkPhase2() && !isPhase2) { fireBossAnimator.SetTrigger("SecondPhase"); isPhase2 = true; fireRate *= 2; moveSpeed *= 2; spreadRate *= 2; bossRadius *= 2; return; } if (isDashing) { if (chargingCountdown > 0) { chargingCountdown -= Time.deltaTime; return; } dashing(); return; } lookAtObject(player.position); if (isMoving) { moving(); } else { int rand; rand = Random.Range(0, dashRate); if (dashRateIncrease == 1) { rand = 1; } if (rand == 1) { isDashing = true; return; } dashRateIncrease -= 1; } // Moving movingCooldown -= Time.deltaTime; if (movingCooldown <= 0 && isMoving == false) { isMoving = true; movePosition = Camera.main.ScreenToWorldPoint(new Vector2(Random.Range(0, Screen.width), Random.Range(0, Screen.height)), 0); float distance = Vector2.Distance(movePosition, transform.position); while (distance < minMoveDistance) { movePosition = Camera.main.ScreenToWorldPoint(new Vector2(Random.Range(0, Screen.width), Random.Range(0, Screen.height)), 0); distance = Vector2.Distance(movePosition, transform.position); } } // Shooting if (fireRateCooldown > 0) { fireRateCooldown -= Time.deltaTime; } else { lookAtObject(player.position); shot(spreadRate * 2); shot(spreadRate); shot(0); shot(-spreadRate); shot(-spreadRate * 2); fireRateCooldown = fireRate; } //Flame circle if (circleCountdown > 0) { circleCountdown -= Time.deltaTime; } else { if (!isActive) { transform.GetChild(1).gameObject.SetActive(true); } if (durationCountdown > 0) { Collider2D playerHit = Physics2D.OverlapCircle(transform.position, flameRadius, whatIsPlayer); if (playerHit != null) { playerHit.GetComponent <PlayerManager>().takeDamage(flameDamage); } durationCountdown -= Time.deltaTime; } else { durationCountdown = duration; circleCountdown = circleRate; transform.GetChild(1).gameObject.SetActive(false); isActive = false; } } }