public void LaunchFireball() { fireball = Instantiate(prefab, transform); fireball.GetComponent <DamageDealer>().StatsSource = statsCog; Vector3 orgRot = animator.gameObject.transform.rotation.eulerAngles; animator.gameObject.transform.rotation = Quaternion.Euler(orgRot.x, Camera.main.transform.rotation.eulerAngles.y, orgRot.z); }
private void spawnFireball(bool isFacingRight) { Fireball castedFireball = (Fireball)fireballs.Dequeue(); Debug.Log("Dequeue'd " + castedFireball.name); castedFireball.gameObject.SetActive(true); currentFireball = castedFireball; if (isFacingRight) { castedFireball.transform.position = (Vector2)playerAnim.transform.position + new Vector2(horizontalOffset, verticalOffset); castedFireball.transform.localScale = Vector2.one; castedFireball.GetComponent <Rigidbody2D>().velocity = new Vector2(fireballspeed, 0); } else { castedFireball.transform.position = (Vector2)playerAnim.transform.position + new Vector2(-horizontalOffset, verticalOffset); castedFireball.transform.localScale = new Vector2(-1, 1); castedFireball.GetComponent <Rigidbody2D>().velocity = new Vector2(-fireballspeed, 0); } HasFireballOut = true; }
void spawnMagentaFireball(float xDisplacement, float speed) { Vector3 spawnDisplacement = Quaternion.Euler(0, 0, -90) * direction; Vector3 spawnPosition = transform.position + (spawnDisplacement * xDisplacement); if (!possibleToSpawnMagentaFireballIn(transform.position, spawnPosition)) { return; } Fireball fireballObj = Instantiate(gameObject, spawnPosition, Quaternion.identity).GetComponent <Fireball>(); fireballObj.initialize(-direction, color); fireballObj.setSpeed(speed); fireballObj.setLifespan(5f); fireballObj.setPower(power); fireballObj.transform.localScale = 0.9f * Vector3.one; if (isEnemyFireball) { fireballObj.setByEnemy(); } // Code snippet to solve a bug causing fireballs to spawn with components disabled if (!fireballObj.GetComponent <Animator>().enabled) { fireballObj.GetComponent <Animator>().enabled = true; } if (!fireballObj.GetComponent <CapsuleCollider2D>().enabled) { fireballObj.GetComponent <CapsuleCollider2D>().enabled = true; } if (!fireballObj.GetComponent <Fireball>().enabled) { fireballObj.GetComponent <Fireball>().enabled = true; } }
public void SpellCombTip(int lvlAndnumber) { CurSpellToolTipBox2.SetActive(true); if (spellCombTip1 == true && lvlAndnumber <= 3) { Empty1(); } if (spellCombTip2 == true && (lvlAndnumber > 3 && lvlAndnumber < 30)) { Empty2(); } if (spellCombTip3 == true && (lvlAndnumber >= 30 && lvlAndnumber < 40)) { Empty3(); } if (spellCombTip4 == true && (lvlAndnumber >= 40 && lvlAndnumber < 50)) { Empty4(); } if (spellCombTip5 == true && (lvlAndnumber >= 50 && lvlAndnumber < 60)) { Empty5(); } if (spellCombTip6 == true && (lvlAndnumber >= 60 && lvlAndnumber < 70)) { Empty6(); } switch (lvlAndnumber) { case 1: curSpellname[0] = fire.spellname; curDamage = fire.damagePure; curCooldown = fire.cooldownSeconds; spellCombTip1 = true; if (GameManager.FindObjectOfType <GameManager>().empowerToken_) { Effect0.text = fire.effect2; } else { Effect0.text = fire.effect; } SpellImage1.sprite = fire.GetComponent <Image>().sprite; break; case 2: curSpellname[0] = frost.spellname; curDamage = frost.damagePure; curCooldown = frost.cooldownSeconds; spellCombTip1 = true; Effect0.text = frost.effect; SpellImage1.sprite = frost.GetComponent <Image>().sprite; if (GameManager.FindObjectOfType <GameManager>().empowerToken_2) { Effect0.text = frost.effect2; } else { Effect0.text = frost.effect; } break; case 3: curSpellname[0] = lightning.spellname; curDamage = lightning.damagePure; curCooldown = lightning.cooldownSeconds; spellCombTip1 = true; Effect0.text = lightning.effect; SpellImage1.sprite = lightning.GetComponent <Image>().sprite; if (GameManager.FindObjectOfType <GameManager>().empowerToken_3) { Effect0.text = lightning.effect2; } else { Effect0.text = lightning.effect; } break; case 21: curSpellname[1] = "-" + meteor.spellname; curDamageModifierlvl2 = meteor.damagePure; curExtraCD = meteor.cooldownSeconds; spellCombTip2 = true; SpellImage2.sprite = meteor.GetComponent <Image>().sprite; break; case 22: curSpellname[1] = "-" + cone.spellname; curExtraCD = cone.cooldownSeconds; curDamageModifierlvl2 = cone.damagePure; spellCombTip2 = true; SpellImage2.sprite = cone.GetComponent <Image>().sprite; break; case 23: curSpellname[1] = "-" + ghostcast.spellname; curDamageModifierlvl2 = ghostcast.damagePure; curExtraCD = ghostcast.cooldownSeconds; spellCombTip2 = true; SpellImage2.sprite = ghostcast.GetComponent <Image>().sprite; break; case 31: curSpellname[2] = "-" + doublecast.spellname; curExtraCD2 = doublecast.cooldownPercent; curDamageModifierlvl3 = doublecast.damagePercent; spellCombTip3 = true; SpellImage3.sprite = doublecast.GetComponent <Image>().sprite; break; case 32: curSpellname[2] = "-" + splitcast.spellname; curExtraCD2 = splitcast.cooldownPercent; curDamageModifierlvl3 = splitcast.damagePercent; spellCombTip3 = true; SpellImage3.sprite = splitcast.GetComponent <Image>().sprite; break; case 33: curSpellname[2] = "-" + companion.spellname; curExtraCD2 = companion.cooldownPercent; curDamageModifierlvl3 = companion.damagePercent; spellCombTip3 = true; SpellImage3.sprite = companion.GetComponent <Image>().sprite; break; case 41: curSpellname[3] = "-" + boost.spellname; curDamageModifierlvl4 = boost.damagePercent; curDamageModifierlvl4_2 = boost.damagePure; spellCombTip4 = true; SpellImage4.sprite = boost.GetComponent <Image>().sprite; break; case 42: curSpellname[3] = "-" + hasten.spellname; curExtraCD3 = hasten.cooldownPercent; spellCombTip4 = true; SpellImage4.sprite = hasten.GetComponent <Image>().sprite; break; case 43: curSpellname[3] = "-" + empower.spellname; spellCombTip4 = true; SpellImage4.sprite = empower.GetComponent <Image>().sprite; break; case 51: curSpellname[4] = "-" + blackhole.spellname; curExtraCD4 = blackhole.cooldownSeconds; spellCombTip5 = true; SpellImage5.sprite = blackhole.GetComponent <Image>().sprite; break; case 52: curSpellname[4] = "-" + push.spellname; curExtraCD4 = push.cooldownSeconds; spellCombTip5 = true; SpellImage5.sprite = push.GetComponent <Image>().sprite; break; case 53: curSpellname[4] = "-" + pool.spellname; curExtraCD4 = pool.cooldownSeconds; spellCombTip5 = true; SpellImage5.sprite = pool.GetComponent <Image>().sprite; break; case 61: curSpellname[5] = "-" + chaosorb.spellname; curExtraCD5 = chaosorb.cooldownPercent; curExtraCD5_2 = chaosorb.cooldownSeconds; spellCombTip6 = true; SpellImage6.sprite = chaosorb.GetComponent <Image>().sprite; break; case 62: curSpellname[5] = "-" + channling.spellname; curExtraCD5 = channling.cooldownPercent; curExtraCD5_2 = channling.cooldownSeconds; curDamageModifierlvl5 = channling.damagePercent; spellCombTip6 = true; SpellImage6.sprite = channling.GetComponent <Image>().sprite; break; case 63: curSpellname[5] = "-" + blessedaim.spellname; curExtraCD5 = blessedaim.cooldownPercent; curDamageModifierlvl5 = blessedaim.damagePercent; spellCombTip6 = true; SpellImage6.sprite = blessedaim.GetComponent <Image>().sprite; break; default: break; } curTSpellname.text = curSpellname[0] + curSpellname[1] + curSpellname[2] + curSpellname[3] + curSpellname[4] + curSpellname[5]; curTDamage.text = "Damage: " + ((curDamage + curDamageModifierlvl2 + curDamageModifierlvl4_2) * curDamageModifierlvl3 * curDamageModifierlvl4 * curDamageModifierlvl5).ToString("F1"); curTCooldown.text = "Cooldown: " + ((curCooldown + curExtraCD + curExtraCD4 + curExtraCD5_2) * curExtraCD2 * curExtraCD3 * curExtraCD5).ToString("F1"); }