public override void Enter() { moving = false; if (barrierPot == null) { barrierPot = owner.GetComponent <BarrierPot>(); } if (waypoint == null && barrierPot != null) { waypoint = barrierPot.Waypoint; } }
IEnumerator AnimatePots() { animating = true; boss.animator.SetTrigger("Animate_Pots"); BarrierPot bp = null; foreach (Pot p in Pots) { if (p == null) { continue; } if (!p.enabled) { p.animator.SetTrigger("Awake"); bp = p as BarrierPot; if (bp != null) { p.enabled = true; bp.owningBoss = boss; boss.barrierPots.Add(bp); } } } while (boss.animator.GetCurrentAnimatorStateInfo(0).IsName("Boss2_Idle")) { yield return(null); } GameObject particleSystem = GameObject.Instantiate(boss.ParticlePrefab, boss.transform.position, boss.ParticlePrefab.transform.rotation); while (boss.animator.GetCurrentAnimatorStateInfo(0).IsName("Boss2_Animate_Pots")) { yield return(null); } foreach (BarrierPot barrierPot in boss.barrierPots) { if (barrierPot != null && barrierPot.isActiveAndEnabled) { Waypoint w = FindBestEmptyBarrierWaypoint(barrierPot.transform.position); if (w != null) { w.Visited = true; barrierPot.Waypoint = w; barrierPot.GetStateMachine().ChangeState("BarrierPot_EnterFormation"); } } } boss.barrierPots.ForEach(x => Debug.Log(x.name)); while (boss.barrierPots.Exists(p => p.isActiveAndEnabled && !p.InPosition)) { yield return(null); } foreach (Pot p in Pots) { if (p != null && !p.enabled) { p.enabled = true; } } yield return(new WaitForSeconds(.2f)); doneAnimating = true; }