void DealDamageOverTime(Monster enemy) { enemy.Slow(FrostBoltSlow, SlowDuration, SlowPercent); enemy.Burn(FireBallBurn, BurnDuration, BurnPercent, damage * Time.deltaTime); enemy.BoltBounce(LBBounce, channeling, Unmodified, gameObject, chainID); enemy.TakeDamage(damage * Time.deltaTime); if (Push) { if (aoeSizeMeteor > 0) { directionF = (enemy.transform.position - transform.position).normalized; } enemy.pushDir = directionF; enemy.ChannelPush(4 * Time.deltaTime); } if (BHBool && BlackHole != null) { GameObject blackH = Instantiate(BlackHole, enemy.transform.position, transform.rotation, transform); ActualPlayer.SpellsCastInThisRoom.Add(blackH); blackH.transform.parent = null; blackH.transform.localScale = BHSize; blackH.GetComponent <GravityBody>().pullRadius = BHRadius; blackH.GetComponent <GravityBody>().pullForce = BHStrenght; blackH.GetComponent <GravityBody>().duration = BHDuration; BHBool = false; } if (pool && PoolInst != null) { GameObject PoolObj = Instantiate(PoolInst, new Vector3(enemy.transform.position.x, 1, enemy.transform.position.z), PoolInst.transform.rotation, transform); ActualPlayer.SpellsCastInThisRoom.Add(PoolObj); PoolObj.transform.parent = null; PoolObj.transform.localScale = new Vector3(2, 2, 2); Poolscript curPool = PoolObj.GetComponent <Poolscript>(); curPool.TriggerKillMe(Poolduration); curPool.damage = PoolDamage; curPool.FrostBoltSlow = FrostBoltSlow; curPool.SlowPercent = SlowPercent; curPool.SlowDuration = SlowDuration; curPool.FireBallBurn = FireBallBurn; curPool.BurnPercent = BurnPercent; curPool.BurnDuration = BurnDuration; curPool.LBBounce = LBBounce; curPool.LBBounceAmount = LBBounceAmount; curPool.Unmodified = Unmodified; curPool.projectilespeed = projectilespeed; curPool.ghostCast = ghostCast; curPool.spellName = spellName; pool = false; } }
public void BoltBounce(bool bounce, bool channel, GameObject bolt, GameObject Current, bool Monster) { if (channel && ChannelTimer > 0) { noBounce = true; } else { noBounce = false; } if (bounce && noBounce == false) { if (!Monster) { MonsterList = GameObject.FindGameObjectsWithTag("Monster"); } else { MonsterList = GameObject.FindGameObjectsWithTag("Player"); } foreach (GameObject enemy in MonsterList) { // if not null might need float dist = Vector3.Distance(enemy.transform.position, transform.position); if (dist < 20 && dist > 1) { MonsterList2.Add(enemy); } } if (MonsterList2.Count >= 1) { var randomTarget = Random.Range(0, MonsterList2.Count); var Rot = Quaternion.LookRotation((MonsterList[randomTarget].transform.position - transform.position).normalized); var Pos2 = Vector3.MoveTowards(this.transform.position, MonsterList[randomTarget].transform.position, BounceDistance); GameObject Bounce = Instantiate(bolt, new Vector3(Pos2.x, 2.6f, Pos2.z), Rot, this.transform); SpellProjectile spell = Bounce.GetComponent <SpellProjectile>(); if (Current.GetComponent <SpellProjectile>() != null) { if (!spell.enabled) { spell.enabled = true; } SpellProjectile curr = Current.GetComponent <SpellProjectile>(); spell.damage = curr.damage; spell.projectilespeed = curr.projectilespeed; spell.ghostCast = false; spell.spellName = curr.spellName; spell.LBBounce = curr.LBBounce; spell.Push = curr.Push; spell.LBBounceAmount = curr.LBBounceAmount - 1; spell.enemyCastingspell = Monster; } else { Poolscript curr = Current.GetComponent <Poolscript>(); spell.damage = curr.damage; spell.projectilespeed = curr.projectilespeed; spell.ghostCast = false; spell.spellName = curr.spellName; spell.LBBounce = curr.LBBounce; spell.LBBounceAmount = curr.LBBounceAmount - 1; spell.enemyCastingspell = Monster; } Bounce.transform.parent = null; Bounce.transform.localScale = new Vector3(1f, 1f, 1f); spell.spellCastLocation = MonsterList2[randomTarget].transform.position; spell.channeling = false; spell.cone = false; spell.aoeSizeMeteor = 0; spell.BHBool = false; if (spell.LBBounceAmount <= 0) { spell.LBBounce = false; // could make it count --; } if (channel) { Bounce.gameObject.GetComponent <Collider>().enabled = true; spell.lightChild1.GetComponent <ParticleSystemRenderer>().lengthScale = 1; spell.lightChild2.GetComponent <ParticleSystemRenderer>().lengthScale = 1; spell.lightChild3.GetComponent <ParticleSystemRenderer>().lengthScale = 1; spell.lightChild4.GetComponent <ParticleSystemRenderer>().lengthScale = 1; spell.lightChild5.GetComponent <ParticleSystemRenderer>().lengthScale = 1; spell.lightChild6.GetComponent <ParticleSystemRenderer>().lengthScale = 1; ChannelTimer = 0.75f; } } MonsterList2.Clear(); } ChannelTimer -= Time.deltaTime; }