private IEnumerator useTimerSkill() { if (timeDelay != null) { yield return(timeDelay); } internalTimer = skillRate; while (isRunning) { while (internalTimer < skillRate) { internalTimer += Time.deltaTime; yield return(null); } if (!isRunning) { break; } System.Random rand = new System.Random(); List <Orb> potentialOrbs = new List <Orb>(); Orb selectedOrb; switch (endSkill) { case EnemySkillType.CLEAR: for (int c = 0; c < Board.COLUMNS; c++) { for (int r = 0; r < Board.ROWS; r++) { Orb o = Board.Instance.getOrb(c, r); if (rmvCondition(o) && !o.getIsMarkedBy(skillID)) { potentialOrbs.Add(o); } } } if (potentialOrbs.Count > 0) { selectedOrb = potentialOrbs[rand.Next(potentialOrbs.Count)]; Vector2Int gridPos = selectedOrb.getGridPos(); yield return(StartCoroutine(Board.Instance.markOrbAt(gridPos.x, gridPos.y, skillID, 0f))); Board.Instance.displayNumBar(); } break; case EnemySkillType.REPLACE: for (int c = 0; c < Board.COLUMNS; c++) { for (int r = 0; r < Board.ROWS; r++) { Orb o = Board.Instance.getOrb(c, r); if (setCondition(o) != o.getOrbValue()) { potentialOrbs.Add(o); } } } if (potentialOrbs.Count > 0) { selectedOrb = potentialOrbs[rand.Next(potentialOrbs.Count)]; selectedOrb.changeValue(setCondition(selectedOrb)); Board.Instance.displayNumBar(); } break; case EnemySkillType.DECREMENT: for (int c = 0; c < Board.COLUMNS; c++) { for (int r = 0; r < Board.ROWS; r++) { Orb o = Board.Instance.getOrb(c, r); int deltaVal = incCondition(o); if (deltaVal != 0 && o.isDigit() && o.getIntValue() + deltaVal <= 9 && o.getIntValue() + deltaVal >= 0) { potentialOrbs.Add(o); } } } if (potentialOrbs.Count > 0) { selectedOrb = potentialOrbs[rand.Next(potentialOrbs.Count)]; selectedOrb.incrementValue(incCondition(selectedOrb)); Board.Instance.displayNumBar(); } break; case EnemySkillType.ATTACK: yield return(StartCoroutine(Player.Instance.inflictDOT(getDOT()))); break; } internalTimer = 0; } }