public void Fire() { if (Time.time < firedLast + weaponData.GetFirerate()) { return; } firedLast = Time.time; if (ammoCount <= 0) { Reload(); // Play out of ammo in clip sound effect? return; } // animator.SetTrigger("Shoot"); audioSource.clip = weaponData.GetFireSound(); audioSource.Play(); ammoCount--; UIController.Instance.GetHUD().ChangeAmmo(ammoCount); GameObject bulletObject = ObjectPoolingManager.Instance.GetBullet(); bulletObject.transform.position = shootPos.transform.position + shootPos.transform.forward; bulletObject.transform.forward = shootPos.transform.forward; }
public float GetWeaponFirerate() { return(playerWeaponData.GetFirerate()); }
public void OpenDetailsPanel(WeaponData wd) { if (wd == null) { detailsParentCG.gameObject.SetActive(false); return; } detailsParentCG.gameObject.SetActive(true); StopCoroutine("OpenMenuAnimation"); StartCoroutine("OpenMenuAnimation"); detailsDescElementPositive.gameObject.SetActive(false); detailsDescElementNegative.gameObject.SetActive(false); detailsDescTraits.gameObject.SetActive(true); //TEMP detailsTrait.text = wd.GetWeaponProjectileTrajectory().ToString(); wdOnDisplay = wd; detailsBackgroundCryo.gameObject.SetActive(wd.GetWeaponElement() == WeaponData.DamageElement.cryo); detailsBackgroundPhoton.gameObject.SetActive(wd.GetWeaponElement() == WeaponData.DamageElement.photon); detailsBackgroundPulse.gameObject.SetActive(wd.GetWeaponElement() == WeaponData.DamageElement.pulse); detailsBackgroundElectric.gameObject.SetActive(wd.GetWeaponElement() == WeaponData.DamageElement.electric); detailsBackgroundNuclear.gameObject.SetActive(wd.GetWeaponElement() == WeaponData.DamageElement.nuclear); detailsBackgroundPlasma.gameObject.SetActive(wd.GetWeaponElement() == WeaponData.DamageElement.plasma); detailsBackgroundGamma.gameObject.SetActive(wd.GetWeaponElement() == WeaponData.DamageElement.gamma); detailsBackgroundGraviton.gameObject.SetActive(wd.GetWeaponElement() == WeaponData.DamageElement.graviton); detailsWeaponName.text = wd.GetWeaponName(); detailsWeaponLevel.text = wd.GetUpgradeLevel().ToString(); detailsWeaponDmg.text = wd.GetWeaponDamage().ToString() + "x" + wd.GetMultishoot().ToString(); switch (wd.GetWeaponRarity()) { case WeaponData.Rarity.rare: { detailsQualityBorder1.color = detailsQualityBorder2.color = detailsWeaponName.color = GlobalGameManager.currentInstance.GetQualityColorRare(); break; } case WeaponData.Rarity.exotic: { detailsQualityBorder1.color = detailsQualityBorder2.color = detailsWeaponName.color = GlobalGameManager.currentInstance.GetQualityColorExotic(); break; } case WeaponData.Rarity.hiTech: { detailsQualityBorder1.color = detailsQualityBorder2.color = detailsWeaponName.color = GlobalGameManager.currentInstance.GetQualityColorHiTech(); break; } case WeaponData.Rarity.prototype: { detailsQualityBorder1.color = detailsQualityBorder2.color = detailsWeaponName.color = GlobalGameManager.currentInstance.GetQualityColorPrototype(); break; } default: { detailsQualityBorder1.color = detailsQualityBorder2.color = detailsWeaponName.color = GlobalGameManager.currentInstance.GetQualityColorCommon(); break; } } switch (wd.GetWeaponElement()) { case WeaponData.DamageElement.photon: { detailsDescElementPositive.gameObject.SetActive(true); details_elementBonus.text = "Deals " + ((wd.GetWeaponDamage() * 2f).ToString()) + " extra damage over 10 seconds. Multiple instances of this effect can be stacked. \nBullets will pierce through enemies once."; details_elementPenalty.text = "Deals reduced direct damage."; detailsDescElementNegative.gameObject.SetActive(true); break; } case WeaponData.DamageElement.electric: { detailsDescElementPositive.gameObject.SetActive(true); details_elementBonus.text = "Weapon impacts will bounce between close enemies up to 5 times."; details_elementPenalty.text = "Deals reduced direct damage."; detailsDescElementNegative.gameObject.SetActive(true); break; } case WeaponData.DamageElement.cryo: { detailsDescElementPositive.gameObject.SetActive(true); details_elementBonus.text = "Each bullet slows down enemies by " + (wd.GetWeaponDamage() * 0.1f).ToString("F1") + "%, after reaching 50% slow, enemies will be stunnned and will take 100% increased damage for 5 seconds. \nBullets will bounce off walls and enemies once."; details_elementPenalty.text = "Deals reduced direct damage."; detailsDescElementNegative.gameObject.SetActive(true); break; } case WeaponData.DamageElement.gamma: { detailsDescElementPositive.gameObject.SetActive(true); details_elementBonus.text = "Projectiles release a gamma burst after impact"; details_elementPenalty.text = "Heats up extremely fast."; detailsDescElementNegative.gameObject.SetActive(true); break; } case WeaponData.DamageElement.nuclear: { detailsDescElementPositive.gameObject.SetActive(true); details_elementBonus.text = "Projectiles will explode on impact doing area damage."; details_elementPenalty.text = "Can not critically hit."; detailsDescElementNegative.gameObject.SetActive(true); break; } case WeaponData.DamageElement.plasma: { detailsDescElementPositive.gameObject.SetActive(true); details_elementBonus.text = "Lowers enemy deffense, increasing their damage taken, based on damage done."; details_elementPenalty.text = "Deals reduced direct damage."; detailsDescElementNegative.gameObject.SetActive(true); break; } case WeaponData.DamageElement.graviton: { detailsDescElementPositive.gameObject.SetActive(true); details_elementBonus.text = "Projectiles implode dealing area damage, damage of each implosion is increased by 25% after subsecuent hits."; details_elementPenalty.text = "Projectiles will deal damage AFTER a short delay.\nDeals reduced direct damage."; detailsDescElementNegative.gameObject.SetActive(true); break; } default: { detailsDescElementPositive.gameObject.SetActive(true); details_elementBonus.text = "This weapon has no elemental effects, but it has balanced stats and reduced heat."; detailsDescElementNegative.gameObject.SetActive(false); break; } } detailsFirerate.text = wd.GetFirerate().ToString("F1") + "/sec"; if (wd.GetWeaponElement() != WeaponData.DamageElement.nuclear) { detailsCritC.text = wd.GetCritChance().ToString("F0") + "%"; detailsCritX.text = "X " + wd.GetCritMultiplier().ToString("F1"); } else { detailsCritC.text = "N/A"; detailsCritX.text = "N/A"; } detailsHeat.text = wd.GetHeatPerProjectile().ToString() + "x" + wd.GetMultishoot(); }