private void Start() { anim = GetComponentInChildren <Animator>(); GameObject.Find("BossUI").transform.GetChild(0).gameObject.SetActive(true); healthbar = FindObjectOfType <BossHealthbar>(); maxHP = GetComponent <enemy>().health; circleAttack = GetComponent <CircleShoot>(); UpdateBossPhase(bossPhases[0]); StartCoroutine(AttackLoop()); float step = maxHP / bossPhases.Length; for (int i = 0; i < bossPhases.Length; i++) { Debug.Log("Phase " + i + " at " + (maxHP - step * i)); } }
public void CircleShot() { if (count > 0) { float step = 360.0f / count; Vector3 dir = transform.forward; for (float angle = 0; angle < 360f; angle += step) { dir = Quaternion.AngleAxis(step, Vector3.up) * dir; GameObject shot = Instantiate(projectile, spawnOffset + transform.position + dir.normalized * spawnDistanceFromCenter, transform.rotation); shot.GetComponent <Rigidbody>().AddForce(dir * force); CircleShoot newCircleShoot = shot.GetComponent <CircleShoot>(); newCircleShoot.count = count - 1; newCircleShoot.force = force; newCircleShoot.minCount = minCount; newCircleShoot.splitTime = splitTime; newCircleShoot.recursive = recursive; if (!recursive) { Destroy(newCircleShoot.gameObject, splitTime * 4f); } } } }