private IEnumerator ScaleBuff(Collider other, int steps, bool up, AoeBuff buff) { // Debug.Log("Scaling up buff on " + other.gameObject); // Debug.Log(steps + " steps"); float stepAmount = _buffs[buff].Modifier / steps; Mod _incMod = new Mod(buff.Target, stepAmount, buff.Direct ? "direct" : "multiplier"); WaitForSeconds wait = new WaitForSeconds(1f); for (int i = 0; i < steps; i++) { // Debug.Log("Applied buff number " + i); try { other.GetComponent <IEnemyHealth>().UpdateModifier(_incMod, up); } catch (Exception e) { Debug.Log(e.StackTrace); } yield return(wait); } // Debug.Log("done scaling buff!"); }
private void SpawnMegaBoss() { GameObject megaBoss = RandomSpawner().SpawnBoss(_megaBoss); megaBoss.GetComponent <Boss>().Type = EnemyType.MegaBoss; foreach (BossColour colour in _megaBossColours) { BossReward bossReward = null; try { bossReward = ShrineManager.Boss(colour).GetComponent <BossReward>(); } catch (Exception) { Debug.Log("no boss reward found"); } try { AoeBuff bossBuff = ShrineManager.Boss(colour).GetComponent <AoeBuff>(); AoeBuff newBuff = megaBoss.AddComponent <AoeBuff>(); newBuff.Tag = bossBuff.Tag; newBuff.Direct = bossBuff.Direct; newBuff.Target = bossBuff.Target; newBuff.Modifier = bossReward != null ? bossReward.Modifiers[ShrineManager.ShrineLevels[colour]] : bossBuff.Modifier; Debug.Log(newBuff.Modifier); } catch (NullReferenceException) { Debug.Log("no AOEBuff found on boss"); } try { FollowerBuff followerBuff = _prefabManager.Get("follower_" + colour).GetComponent <FollowerBuff>(); if (followerBuff == null) { break; } FollowerBuff newBuff = megaBoss.AddComponent <FollowerBuff>(); newBuff.Direct = followerBuff.Direct; newBuff.Target = followerBuff.Target; newBuff.Modifier = bossReward != null ? bossReward.Modifiers[ShrineManager.ShrineLevels[colour]] : followerBuff.Modifier; } catch (Exception) { Debug.Log("no followerbuff for boss colour"); } } _megaBossColours.Clear(); }