public override void Fire() { if (currentWeaponState == State.Ready && currentAmmo > 0) { currentAmmo = currentAmmo - 1; ////////////////////////////////////////////////////////////// if (PrimaryWeaponAudioSource.clip != Clip_Shot) { PrimaryWeaponAudioSource.clip = Clip_Shot; } StartCoroutine(ShotSound()); /////////////////////////////////////////////////////////////////// // Play Shot sound //////////////////////////////////////////////////// //WeaponAudioSource.clip = Clip_Shot; //WeaponAudioSource.Play(); /////////////////////////////////////////////////////////////////////// foreach (GameObject i in projectileOrigins) { Rigidbody clone = Instantiate(projectile, i.transform.position, i.transform.rotation); Projectile_Class projectileClone = clone.GetComponent <Projectile_Class>(); if (projectileClone != null) { projectileClone.ProjectileDamage = projectileClone.ProjectileDamage * DamageModifer; } Throwable_Class throwableClone = clone.GetComponent <Throwable_Class>(); if (throwableClone != null) { throwableClone.SetLive(); } clone.transform.Rotate (Random.Range(-1 * ProjectileSpread, ProjectileSpread), Random.Range(-1 * ProjectileSpread, ProjectileSpread), 0); clone.AddForce(clone.transform.forward * projectileSpeed); } StartCoroutine(FireRateCoolDown()); } } /////
//Throws the equipped throwable and arms it public void ThrowThrowable() { EquippedThrowableScript.Release(ThrowableForce, GetComponent <Collider>()); EquippedThrowableScript.SetLive(); EquippedThrowableScript = null; }